11add_rules (" mode.debug" , " mode.release" )
22
3- toolchain (" arm-none-eabi " )
3+ toolchain (" ${toolchain} " )
44 set_kind (" standalone" )
5- set_sdkdir (" /home/bernard/.env/tools/scripts/packages/arm-none-eabi-gcc-v13.2.rel1 " )
5+ set_sdkdir (" ${sdkdir} " )
66toolchain_end ()
77
8- target (" rt-thread " )
8+ target (" ${target} " )
99 set_kind (" binary" )
10- set_toolchains (" arm-none-eabi " )
10+ set_toolchains (" ${toolchain} " )
1111
1212 add_files (
13- " applications/main.c" ,
14- " ../../../components/libc/compilers/common/cctype.c" ,
15- " ../../../components/libc/compilers/common/cstdlib.c" ,
16- " ../../../components/libc/compilers/common/cstring.c" ,
17- " ../../../components/libc/compilers/common/ctime.c" ,
18- " ../../../components/libc/compilers/common/cunistd.c" ,
19- " ../../../components/libc/compilers/common/cwchar.c" ,
20- " ../../../components/libc/compilers/newlib/syscalls.c" ,
21- " ../../../components/drivers/core/device.c" ,
22- " ../../../components/drivers/ipc/completion_comm.c" ,
23- " ../../../components/drivers/ipc/completion_up.c" ,
24- " ../../../components/drivers/ipc/condvar.c" ,
25- " ../../../components/drivers/ipc/dataqueue.c" ,
26- " ../../../components/drivers/ipc/pipe.c" ,
27- " ../../../components/drivers/ipc/ringblk_buf.c" ,
28- " ../../../components/drivers/ipc/ringbuffer.c" ,
29- " ../../../components/drivers/ipc/waitqueue.c" ,
30- " ../../../components/drivers/ipc/workqueue.c" ,
31- " ../../../components/drivers/pin/dev_pin.c" ,
32- " ../../../components/drivers/serial/dev_serial.c" ,
33- " ../libraries/HAL_Drivers/drivers/drv_gpio.c" ,
34- " ../libraries/HAL_Drivers/drivers/drv_usart.c" ,
35- " ../libraries/HAL_Drivers/drv_common.c" ,
36- " board/CubeMX_Config/Src/stm32f4xx_hal_msp.c" ,
37- " board/board.c" ,
38- " ../../../components/finsh/shell.c" ,
39- " ../../../components/finsh/msh.c" ,
40- " ../../../components/finsh/msh_parse.c" ,
41- " ../../../components/finsh/cmd.c" ,
42- " ../../../src/clock.c" ,
43- " ../../../src/components.c" ,
44- " ../../../src/cpu_up.c" ,
45- " ../../../src/defunct.c" ,
46- " ../../../src/idle.c" ,
47- " ../../../src/ipc.c" ,
48- " ../../../src/irq.c" ,
49- " ../../../src/kservice.c" ,
50- " ../../../src/mem.c" ,
51- " ../../../src/mempool.c" ,
52- " ../../../src/object.c" ,
53- " ../../../src/scheduler_comm.c" ,
54- " ../../../src/scheduler_up.c" ,
55- " ../../../src/thread.c" ,
56- " ../../../src/timer.c" ,
57- " ../../../src/klibc/kstring.c" ,
58- " ../../../src/klibc/rt_vsscanf.c" ,
59- " ../../../src/klibc/kstdio.c" ,
60- " ../../../src/klibc/rt_vsnprintf_tiny.c" ,
61- " ../../../src/klibc/kerrno.c" ,
62- " ../../../libcpu/arm/common/atomic_arm.c" ,
63- " ../../../libcpu/arm/common/div0.c" ,
64- " ../../../libcpu/arm/common/showmem.c" ,
65- " ../../../libcpu/arm/cortex-m4/context_gcc.S" ,
66- " ../../../libcpu/arm/cortex-m4/cpuport.c" ,
67- " packages/stm32f4_cmsis_driver-latest/Source/Templates/gcc/startup_stm32f412zx.s" ,
68- " packages/stm32f4_cmsis_driver-latest/Source/Templates/system_stm32f4xx.c" ,
69- " packages/stm32f4_hal_driver-latest/Src/stm32f4xx_hal_dma_ex.c" ,
70- " packages/stm32f4_hal_driver-latest/Src/stm32f4xx_hal_usart.c" ,
71- " packages/stm32f4_hal_driver-latest/Src/stm32f4xx_hal_pwr_ex.c" ,
72- " packages/stm32f4_hal_driver-latest/Src/stm32f4xx_hal_cryp.c" ,
73- " packages/stm32f4_hal_driver-latest/Src/stm32f4xx_hal_gpio.c" ,
74- " packages/stm32f4_hal_driver-latest/Src/stm32f4xx_hal_rcc.c" ,
75- " packages/stm32f4_hal_driver-latest/Src/stm32f4xx_hal.c" ,
76- " packages/stm32f4_hal_driver-latest/Src/stm32f4xx_hal_cortex.c" ,
77- " packages/stm32f4_hal_driver-latest/Src/stm32f4xx_hal_pwr.c" ,
78- " packages/stm32f4_hal_driver-latest/Src/stm32f4xx_hal_cec.c" ,
79- " packages/stm32f4_hal_driver-latest/Src/stm32f4xx_hal_cryp_ex.c" ,
80- " packages/stm32f4_hal_driver-latest/Src/stm32f4xx_hal_dma.c" ,
81- " packages/stm32f4_hal_driver-latest/Src/stm32f4xx_hal_uart.c" ,
82- " packages/stm32f4_hal_driver-latest/Src/stm32f4xx_hal_rcc_ex.c" ,
83- " packages/stm32f4_hal_driver-latest/Src/stm32f4xx_hal_crc.c" ,
84- " packages/stm32f4_hal_driver-latest/Src/stm32f4xx_hal_rng.c"
13+ ${src_path }
8514 )
8615
8716 add_includedirs (
88- " applications" ,
89- " packages/CMSIS-Core-latest/Include" ,
90- " ../../../components/libc/compilers/newlib" ,
91- " ../../../components/libc/compilers/common/include" ,
92- " ../../../components/drivers/include" ,
93- " ../../../components/drivers/smp_call" ,
94- " ../../../components/drivers/phy" ,
95- " board" ,
96- " board/CubeMX_Config/Inc" ,
97- " ../libraries/HAL_Drivers/drivers" ,
98- " ../libraries/HAL_Drivers/drivers/config" ,
99- " ../libraries/HAL_Drivers" ,
100- " ../../../components/finsh" ,
101- " ." ,
102- " ../../../include" ,
103- " ../../../libcpu/arm/common" ,
104- " ../../../libcpu/arm/cortex-m4" ,
105- " ../../../components/libc/posix/ipc" ,
106- " ../../../components/libc/posix/io/poll" ,
107- " ../../../components/libc/posix/io/eventfd" ,
108- " ../../../components/libc/posix/io/epoll" ,
109- " packages/stm32f4_cmsis_driver-latest/Include" ,
110- " packages/stm32f4_hal_driver-latest/Inc" ,
111- " packages/stm32f4_hal_driver-latest/Inc/Legacy"
17+ ${inc_path }
11218 )
11319
11420 add_defines (
115- " RT_USING_LIBC" ,
116- " RT_USING_NEWLIBC" ,
117- " STM32F412Zx" ,
118- " USE_HAL_DRIVER" ,
119- " _POSIX_C_SOURCE=1" ,
120- " __RTTHREAD__"
21+ ${define }
12122 )
12223
12324 add_cflags (
124- " -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -Dgcc -O0 -gdwarf-2 -g " ,{force = true }
25+ " ${cflags} " ,{force = true }
12526 )
12627 add_cxxflags (
127- " -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -Dgcc -O0 -gdwarf-2 -g " ,{force = true }
28+ " ${cxxflags} " ,{force = true }
12829 )
12930
13031 add_asflags (
131- " -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -x assembler-with-cpp -Wa,-mimplicit-it=thumb -gdwarf-2 " ,{force = true }
32+ " ${asflags} " ,{force = true }
13233 )
13334
13435 add_ldflags (
135- " -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds " ,{force = true }
36+ " ${ldflags} " ,{force = true }
13637 )
13738
13839 set_targetdir (" ./" )
13940 set_filename (" rtthread.elf" )
14041
14142 after_build (function (target )
142- os .exec (" /home/bernard/.env/tools/scripts/packages/arm-none-eabi-gcc-v13.2.rel1/bin/arm-none-eabi -objcopy -O ihex rtthread.elf rtthread.hex" )
143- os .exec (" /home/bernard/.env/tools/scripts/packages/arm-none-eabi-gcc-v13.2.rel1/bin/arm-none-eabi -objcopy -O binary rtthread.elf rtthread.bin" )
144- os .exec (" /home/bernard/.env/tools/scripts/packages/arm-none-eabi-gcc-v13.2.rel1/bin/arm-none-eabi -size rtthread.elf" )
43+ os .exec (" ${bindir}/${toolchain} -objcopy -O ihex rtthread.elf rtthread.hex" )
44+ os .exec (" ${bindir}/${toolchain} -objcopy -O binary rtthread.elf rtthread.bin" )
45+ os .exec (" ${bindir}/${toolchain} -size rtthread.elf" )
14546 end )
0 commit comments