some chibios experiments
This commit is contained in:
+185
-196
File diff suppressed because it is too large
Load Diff
@@ -12,14 +12,19 @@ function(ParseMakefile MKFile)
|
||||
endfunction()
|
||||
|
||||
macro(_ParseMakefile MKFile)
|
||||
message(STATUS "Parsing ${MKFile}")
|
||||
file(READ "${MKFile}" FileContents)
|
||||
string(REPLACE "\\\n" "" FileContents ${FileContents})
|
||||
string(REPLACE "\n" ";" FileLines ${FileContents})
|
||||
string(REGEX REPLACE "\\\\\r?\n *" " " FileContents ${FileContents})
|
||||
string(REGEX REPLACE "\r?\n" ";" FileLines ${FileContents})
|
||||
list(REMOVE_ITEM FileLines "")
|
||||
foreach(line ${FileLines})
|
||||
# if(line MATCHES "$\\((.+)\\)")
|
||||
# string(REPLACE "(${CMAKE_MATCH_1})" "{${CMAKE_MATCH_1}}" line ${line})
|
||||
# if(line MATCHES "\\$\\((.+)\\)")
|
||||
# set(MAKE_VARIABLE "${CMAKE_MATCH_1}")
|
||||
# string(REPLACE "$(${MAKE_VARIABLE})" "${${MAKE_VARIABLE}}" line ${line})
|
||||
# endif()
|
||||
# message(STATUS "From: ${line}")
|
||||
string(REGEX REPLACE "\\$\\(([^\\(\\)]+)\\)" "${CHIBIOS}" line ${line})
|
||||
# message(STATUS "To : ${line}")
|
||||
# if(line MATCHES "^include (.+)$")
|
||||
# set(MAKE_CHILD ${CMAKE_MATCH_1})
|
||||
# message(STATUS "Reading ${MAKE_CHILD}")
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
target_sources(qmk PUBLIC ${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/ADCv3/hal_adc_lld.c)
|
||||
target_include_directories(qmk PUBLIC ${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/ADCv3)
|
||||
@@ -0,0 +1,2 @@
|
||||
target_sources(qmk PUBLIC ${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/CANv1/hal_can_lld.c)
|
||||
target_include_directories(qmk PUBLIC ${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/CANv1)
|
||||
@@ -0,0 +1,2 @@
|
||||
target_sources(qmk PUBLIC ${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/DACv1/hal_dac_lld.c)
|
||||
target_include_directories(qmk PUBLIC ${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/DACv1)
|
||||
@@ -0,0 +1,2 @@
|
||||
target_sources(qmk PUBLIC ${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/DMAv1/stm32_dma.c)
|
||||
target_include_directories(qmk PUBLIC ${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/DMAv1)
|
||||
@@ -0,0 +1,2 @@
|
||||
target_sources(qmk PUBLIC ${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/EXTIv1/stm32_exti.c)
|
||||
target_include_directories(qmk PUBLIC ${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/EXTIv1)
|
||||
@@ -0,0 +1,2 @@
|
||||
target_sources(qmk PUBLIC ${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/GPIOv2/hal_pal_lld.c)
|
||||
target_include_directories(qmk PUBLIC ${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/GPIOv2)
|
||||
@@ -0,0 +1,7 @@
|
||||
if(${USE_HAL_I2C_FALLBACK})
|
||||
target_sources(qmk PUBLIC ${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/I2C/hal_i2c_lld.c)
|
||||
target_include_directories(qmk PUBLIC ${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/I2C)
|
||||
else()
|
||||
target_sources(qmk PUBLIC ${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/I2Cv2/hal_i2c_lld.c)
|
||||
target_include_directories(qmk PUBLIC ${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/I2Cv2)
|
||||
endif()
|
||||
@@ -0,0 +1,2 @@
|
||||
target_sources(qmk PUBLIC ${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/RTCv2/hal_rtc_lld.c)
|
||||
target_include_directories(qmk PUBLIC ${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/RTCv2)
|
||||
@@ -0,0 +1,5 @@
|
||||
target_sources(qmk PUBLIC
|
||||
${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/SPIv2/hal_i2s_lld.c
|
||||
${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/SPIv2/hal_spi_v2_lld.c
|
||||
)
|
||||
target_include_directories(qmk PUBLIC ${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/SPIv2)
|
||||
@@ -0,0 +1,2 @@
|
||||
target_sources(qmk PUBLIC ${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/SYSTICKv1/hal_st_lld.c)
|
||||
target_include_directories(qmk PUBLIC ${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/SYSTICKv1)
|
||||
@@ -0,0 +1,6 @@
|
||||
target_sources(qmk PUBLIC
|
||||
${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/TIMv1/hal_gpt_lld.c
|
||||
${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/TIMv1/hal_icu_lld.c
|
||||
${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/TIMv1/hal_pwm_lld.c
|
||||
)
|
||||
target_include_directories(qmk PUBLIC ${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/TIMv1)
|
||||
@@ -0,0 +1,9 @@
|
||||
target_sources(qmk PUBLIC
|
||||
${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/USARTv2/hal_serial_lld.c
|
||||
${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/USARTv2/hal_sio_lld.c
|
||||
${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/USARTv2/hal_uart_lld.c
|
||||
)
|
||||
target_include_directories(qmk PUBLIC
|
||||
${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/USART
|
||||
${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/USARTv2
|
||||
)
|
||||
@@ -0,0 +1,6 @@
|
||||
target_sources(qmk PUBLIC
|
||||
${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/USBv1/hal_usb_lld.c
|
||||
)
|
||||
target_include_directories(qmk PUBLIC
|
||||
${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/USBv1
|
||||
)
|
||||
@@ -0,0 +1,6 @@
|
||||
target_sources(qmk PUBLIC
|
||||
${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/xWDGv1/hal_wdg_lld.c
|
||||
)
|
||||
target_include_directories(qmk PUBLIC
|
||||
${CHIBIOS}/os/hal/ports/${MCU_PORT_NAME}/LLD/xWDGv1
|
||||
)
|
||||
@@ -0,0 +1,10 @@
|
||||
# os/common/ports/ARMv7/compilers/GCC/mk/port.mk
|
||||
target_sources(qmk PUBLIC
|
||||
${CHIBIOS}/os/common/ports/ARMv7-M/chcore.c
|
||||
${CHIBIOS}/os/common/ports/ARMv7-M/compilers/GCC/chcoreasm.S
|
||||
)
|
||||
target_include_directories(qmk PUBLIC
|
||||
${CHIBIOS}/os/common/portability/GCC
|
||||
${CHIBIOS}/os/common/ports/ARM-common
|
||||
${CHIBIOS}/os/common/ports/ARMv7-M
|
||||
)
|
||||
@@ -0,0 +1,25 @@
|
||||
# os/hal/ports/STM32/STM32F3xx/platform.mk
|
||||
target_sources(qmk PUBLIC
|
||||
${CHIBIOS}/os/hal/ports/common/ARMCMx/nvic.c
|
||||
${CHIBIOS}/os/hal/ports/STM32/STM32F3xx/stm32_isr.c
|
||||
${CHIBIOS}/os/hal/ports/STM32/STM32F3xx/hal_lld.c
|
||||
${CHIBIOS}/os/hal/ports/STM32/STM32F3xx/hal_efl_lld.c
|
||||
)
|
||||
target_include_directories(qmk PUBLIC
|
||||
${CHIBIOS}/os/hal/ports/common/ARMCMx
|
||||
${CHIBIOS}/os/hal/ports/STM32/STM32F3xx
|
||||
)
|
||||
include(chibios/LLD/ADCv3)
|
||||
include(chibios/LLD/CANv1)
|
||||
include(chibios/LLD/DACv1)
|
||||
include(chibios/LLD/DMAv1)
|
||||
include(chibios/LLD/EXTIv1)
|
||||
include(chibios/LLD/GPIOv2)
|
||||
include(chibios/LLD/I2Cv2)
|
||||
include(chibios/LLD/RTCv2)
|
||||
include(chibios/LLD/SPIv2)
|
||||
include(chibios/LLD/SYSTICKv1)
|
||||
include(chibios/LLD/TIMv1)
|
||||
include(chibios/LLD/USARTv2)
|
||||
include(chibios/LLD/USBv1)
|
||||
include(chibios/LLD/xWDGv1)
|
||||
@@ -1,4 +1,4 @@
|
||||
find_package(chibios REQUIRED)
|
||||
find_package(Chibios REQUIRED)
|
||||
|
||||
target_link_options(qmk PUBLIC
|
||||
-mcpu=${QMK_MCU}
|
||||
@@ -30,8 +30,12 @@ else()
|
||||
)
|
||||
endif()
|
||||
|
||||
# add_library(platforms_chibios)
|
||||
target_sources(qmk PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/syscall-fallbacks.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wait.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/synchronization_util.c
|
||||
)
|
||||
|
||||
target_include_directories(qmk PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_include_directories(qmk PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/boards/common/configs)
|
||||
target_include_directories(qmk PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}/configs)
|
||||
# target_link_libraries(platforms_chibios ${QMK_TARGET})
|
||||
target_include_directories(qmk PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}/configs)
|
||||
@@ -33,7 +33,3 @@ target_include_directories(qmk PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/bootmagic)
|
||||
# target_link_libraries(quantum platforms_${QMK_PLATFORM})
|
||||
# target_link_libraries(quantum tmk_core_protocol)
|
||||
# target_link_libraries(quantum tmk_core_protocol_${QMK_PROTOCOL})
|
||||
|
||||
# if no printf
|
||||
target_sources(qmk PUBLIC ${CMAKE_SOURCE_DIR}/lib/printf/src/printf/printf.c)
|
||||
target_include_directories(qmk PUBLIC ${CMAKE_SOURCE_DIR}/lib/printf/src/printf)
|
||||
@@ -12,7 +12,11 @@ target_sources(qmk PUBLIC
|
||||
usb_util.c
|
||||
)
|
||||
|
||||
find_package(chibios REQUIRED)
|
||||
find_package(Chibios REQUIRED)
|
||||
|
||||
target_include_directories(qmk PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_include_directories(qmk PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/lufa_utils)
|
||||
target_include_directories(qmk PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/lufa_utils)
|
||||
|
||||
# if no printf
|
||||
target_sources(qmk PUBLIC ${CMAKE_SOURCE_DIR}/lib/printf/src/printf/printf.c)
|
||||
target_include_directories(qmk PUBLIC ${CMAKE_SOURCE_DIR}/lib/printf/src/printf)
|
||||
@@ -19,7 +19,7 @@ target_sources(qmk PUBLIC
|
||||
usb_util.c
|
||||
)
|
||||
|
||||
find_package(lufa REQUIRED)
|
||||
find_package(Lufa REQUIRED)
|
||||
# target_compile_definitions(lufa PUBLIC ${COMPILE_DEFINITIONS})
|
||||
|
||||
target_include_directories(qmk PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
Reference in New Issue
Block a user