修复STM32工程在linux上编译失败的问题

This commit is contained in:
zhangzheng
2024-02-28 19:03:47 +08:00
parent a7abe122ab
commit 07eaa699f6
18 changed files with 55 additions and 27 deletions

View File

@@ -90,9 +90,10 @@ endif()
add_executable(bootstrap.elf
${deps}
)
message("CONFIG_CPU_TYPE"=${CONFIG_CPU_TYPE})
string(TOUPPER ${CONFIG_CPU_TYPE} cpu_type)
set_target_properties(bootstrap.elf PROPERTIES LINK_FLAGS
"-T ${CMAKE_CURRENT_LIST_DIR}/bsp/${CONFIG_CPU_TYPE}/link.lds --gc-section ")
"-T ${CMAKE_CURRENT_LIST_DIR}/bsp/${cpu_type}/link.lds --gc-section ")
target_link_libraries(
bootstrap.elf

View File

@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.13)
file(GLOB_RECURSE deps **/*.S *.S **/*.C *.c)
file(GLOB_RECURSE deps **/*.s *.s **/*.C *.c)
add_library(boot_bsp STATIC ${deps})
target_include_directories(

View File

@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.13)
file(GLOB_RECURSE deps **/*.S *.S **/*.C *.c)
file(GLOB_RECURSE deps **/*.s *.s **/*.C *.c)
add_library(boot_bsp STATIC ${deps})
target_include_directories(

View File

@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.13)
file(GLOB_RECURSE deps **/*.S *.S **/*.C *.c)
file(GLOB_RECURSE deps **/*.s *.s **/*.C *.c)
add_library(boot_bsp STATIC ${deps})
target_include_directories(

View File

@@ -53,6 +53,12 @@ void arch_enable_irq(int inx)
{
NVIC_EnableIRQ(inx);
}
uint32_t arch_get_sys_clk(void)
{
extern uint32_t SystemCoreClock;
return SystemCoreClock;
}
void arch_set_enable_irq_prio(int inx, int sub_prio, int pre_prio)
{
NVIC_InitTypeDef NVIC_InitStructure;

View File

@@ -116,3 +116,6 @@ void sys_reset(void);
// systick.c
umword_t sys_tick_cnt_get(void);
uint32_t arch_get_sys_clk(void);

View File

@@ -53,6 +53,12 @@ void arch_enable_irq(int inx)
{
NVIC_EnableIRQ(inx);
}
uint32_t arch_get_sys_clk(void)
{
extern uint32_t SystemCoreClock;
return SystemCoreClock;
}
void arch_set_enable_irq_prio(int inx, int sub_prio, int pre_prio)
{
NVIC_InitTypeDef NVIC_InitStructure;

View File

@@ -116,3 +116,5 @@ void sys_reset(void);
// systick.c
umword_t sys_tick_cnt_get(void);
uint32_t arch_get_sys_clk(void);

View File

@@ -52,6 +52,12 @@ void arch_enable_irq(int inx)
{
NVIC_EnableIRQ(inx);
}
uint32_t arch_get_sys_clk(void)
{
extern uint32_t SystemCoreClock;
return SystemCoreClock;
}
void arch_set_enable_irq_prio(int inx, int sub_prio, int pre_prio)
{
NVIC_InitTypeDef NVIC_InitStructure;

View File

@@ -116,3 +116,5 @@ void sys_reset(void);
// systick.c
umword_t sys_tick_cnt_get(void);
uint32_t arch_get_sys_clk(void);

View File

@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.13)
file(GLOB deps **/*.S *.S **/*.C *.c)
file(GLOB deps **/*.s *.s **/*.C *.c)
file(GLOB bsp_src
${CMAKE_SOURCE_DIR}/mkrtos_bsp/SWM34/SWM341_StdPeriph_Driver/SWM341_StdPeriph_Driver/*.c

View File

@@ -1,8 +1,8 @@
ENTRY(Reset_Handler)
MEMORY
{
RAM (arw) : ORIGIN = 0x20000000, LENGTH = 0x10000
FLASH (arx) : ORIGIN = 0x00000000 + 0x2000, LENGTH = 0x10000 - 0x2000
RAM (arw) : ORIGIN = 0x20000000, LENGTH = 0x2000000
FLASH (arx) : ORIGIN = 0x8000000 + 0x2000, LENGTH = 0x10000 - 0x2000
}
SECTIONS
{

View File

@@ -1,9 +1,9 @@
#!/bin/bash
# export TOOLCHAIN=/home/ATShining/gcc-arm-none-eabi-5_4-2016q3/bin/
# export TOOLCHAIN_LIB=/home/ATShining/gcc-arm-none-eabi-5_4-2016q3/lib/gcc/arm-none-eabi/5.4.1/armv7-m
export TOOLCHAIN=/Users/zhangzheng/gcc-arm-none-eabi-10.3-2021.10/bin/
export TOOLCHAIN_LIB=/Users/zhangzheng/gcc-arm-none-eabi-10.3-2021.10/lib/gcc/arm-none-eabi/10.3.1/thumb/v7-m/nofp
export TOOLCHAIN=/home/zhangzheng/gcc-arm-none-eabi-5_4-2016q3/bin/
export TOOLCHAIN_LIB=/home/zhangzheng/gcc-arm-none-eabi-5_4-2016q3/lib/gcc/arm-none-eabi/5.4.1/armv7-m
# export TOOLCHAIN=/Users/zhangzheng/gcc-arm-none-eabi-10.3-2021.10/bin/
# export TOOLCHAIN_LIB=/Users/zhangzheng/gcc-arm-none-eabi-10.3-2021.10/lib/gcc/arm-none-eabi/10.3.1/thumb/v7-m/nofp
export BOARD=STM32F103ZET6
set -e

View File

@@ -1,9 +1,9 @@
#!/bin/bash
# export TOOLCHAIN=/home/zhangzheng/gcc-arm-none-eabi-5_4-2016q3/bin/
# export TOOLCHAIN_LIB=/home/zhangzheng/gcc-arm-none-eabi-5_4-2016q3/lib/gcc/arm-none-eabi/5.4.1/armv7-m
export TOOLCHAIN=/Users/zhangzheng/gcc-arm-none-eabi-10.3-2021.10/bin/
export TOOLCHAIN_LIB=/Users/zhangzheng/gcc-arm-none-eabi-10.3-2021.10/lib/gcc/arm-none-eabi/10.3.1/thumb/v7-m/nofp
export TOOLCHAIN=/home/zhangzheng/gcc-arm-none-eabi-5_4-2016q3/bin/
export TOOLCHAIN_LIB=/home/zhangzheng/gcc-arm-none-eabi-5_4-2016q3/lib/gcc/arm-none-eabi/5.4.1/armv7-m
# export TOOLCHAIN=/Users/zhangzheng/gcc-arm-none-eabi-10.3-2021.10/bin/
# export TOOLCHAIN_LIB=/Users/zhangzheng/gcc-arm-none-eabi-10.3-2021.10/lib/gcc/arm-none-eabi/10.3.1/thumb/v7-m/nofp
export BOARD=STM32F205
set -e

View File

@@ -1,10 +1,9 @@
#!/bin/bash
# export TOOLCHAIN=/home/zhangzheng/gcc-arm-none-eabi-5_4-2016q3/bin/
# export TOOLCHAIN_LIB=/home/zhangzheng/gcc-arm-none-eabi-5_4-2016q3/lib/gcc/arm-none-eabi/5.4.1/armv7-m
export TOOLCHAIN=/Users/zhangzheng/gcc-arm-none-eabi-10.3-2021.10/bin/
# export TOOLCHAIN_LIB=/Users/zhangzheng/gcc-arm-none-eabi-10.3-2021.10/lib/gcc/arm-none-eabi/10.3.1/thumb/v7-m/nofp
export TOOLCHAIN_LIB=/Users/zhangzheng/gcc-arm-none-eabi-10.3-2021.10/lib/gcc/arm-none-eabi/10.3.1/thumb/v7e-m+fp/hard
export TOOLCHAIN=/home/zhangzheng/gcc-arm-none-eabi-5_4-2016q3/bin/
export TOOLCHAIN_LIB=/home/zhangzheng/gcc-arm-none-eabi-5_4-2016q3/lib/gcc/arm-none-eabi/5.4.1/armv7e-m/fpu
# export TOOLCHAIN=/Users/zhangzheng/gcc-arm-none-eabi-10.3-2021.10/bin/
# export TOOLCHAIN_LIB=/Users/zhangzheng/gcc-arm-none-eabi-10.3-2021.10/lib/gcc/arm-none-eabi/10.3.1/thumb/v7e-m+fp/hard
export BOARD=STM32F407VET6
set -e
cmake -G Ninja -B build/$KNL .

View File

@@ -1,10 +1,9 @@
#!/bin/bash
# export TOOLCHAIN=/home/ATShining/gcc-arm-none-eabi-5_4-2016q3/bin/
# export TOOLCHAIN_LIB=/home/ATShining/gcc-arm-none-eabi-5_4-2016q3/lib/gcc/arm-none-eabi/5.4.1/armv7-m
export TOOLCHAIN=/Users/zhangzheng/gcc-arm-none-eabi-10.3-2021.10/bin/
# export TOOLCHAIN_LIB=/Users/zhangzheng/gcc-arm-none-eabi-10.3-2021.10/lib/gcc/arm-none-eabi/10.3.1/thumb/v8-m.main/nofp
export TOOLCHAIN_LIB=/Users/zhangzheng/gcc-arm-none-eabi-10.3-2021.10/lib/gcc/arm-none-eabi/10.3.1/thumb/v8-m.main+fp/hard
export TOOLCHAIN=/home/zhangzheng/gcc-arm-none-eabi-5_4-2016q3/bin/
export TOOLCHAIN_LIB=/home/zhangzheng/gcc-arm-none-eabi-5_4-2016q3/lib/gcc/arm-none-eabi/5.4.1/armv8-m.main/fpu/fpv5-d16/
# export TOOLCHAIN=/Users/zhangzheng/gcc-arm-none-eabi-10.3-2021.10/bin/
# export TOOLCHAIN_LIB=/Users/zhangzheng/gcc-arm-none-eabi-10.3-2021.10/lib/gcc/arm-none-eabi/10.3.1/thumb/v8-m.main+fp/hard
export BOARD=SWM34
set -e

View File

@@ -10,7 +10,11 @@
#include <assert.h>
static pthread_spinlock_t lock;
extern void *app_start_addr;
#ifdef CONFIG_EX_RAM_SIZE
static umword_t mm_bitemp[ROUND(CONFIG_EX_RAM_SIZE, MK_PAGE_SIZE) / (sizeof(umword_t) * 8) + 1];
#else
static umword_t mm_bitemp[ROUND(CONFIG_KNL_DATA_SIZE, MK_PAGE_SIZE) / (sizeof(umword_t) * 8) + 1];
#endif
static void *mm_page_alloc(int page_nr)
{
int cnt = 0;

View File

@@ -39,8 +39,8 @@ add_executable(tcc.elf
target_link_libraries(tcc.elf
PUBLIC
muslc
--whole-archive
start
--whole-archive
sys
sys_util
sys_svr