stm32f2能够运行

This commit is contained in:
zhangzheng
2024-04-11 12:00:49 +08:00
parent 5b2ac390ab
commit acb21792bb
18 changed files with 42 additions and 21 deletions

5
.vscode/launch.json vendored
View File

@@ -47,10 +47,11 @@
"externalConsole": false,
// "miDebuggerPath": "/opt/homebrew/bin/arm-none-eabi-gdb",
"miDebuggerPath": "/home/zhangzheng/gcc-arm/gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi-gdb",
// "miDebuggerPath": "/home/zhangzheng/gcc-arm/gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi-gdb",
"miDebuggerPath": "/home/zhangzheng/gcc-arm-none-eabi-5_4-2016q3/bin/arm-none-eabi-gdb",
// "miDebuggerPath": "/home/zhangzheng/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf/bin/aarch64-none-elf-gdb",
// "miDebuggerPath": "/home/mkrtos-smart/toolchains/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin/aarch64-none-elf-gdb",
"miDebuggerServerAddress": "127.0.0.1:3333",
"miDebuggerServerAddress": "127.0.0.1:33333",
"MIMode": "gdb",
"setupCommands": [
{

View File

@@ -23,10 +23,10 @@ add_custom_target(
add_dependencies(mkrtos_img_dump
bootstrap_dump
mkrtos_dump
# init_dump
init_dump
# app_dump
# shell_dump
shell_dump
# fatfs_dump
# cpiofs_dump
cpiofs_dump
# tcc_dump
)

View File

@@ -124,8 +124,8 @@ void arch_set_enable_irq_prio(int inx, int sub_prio, int pre_prio);
static inline __attribute__((optimize(0))) void preemption(void)
{
cli();
sti();
cli();
}
static inline umword_t intr_status(void)

View File

@@ -127,8 +127,8 @@ void arch_set_enable_irq_prio(int inx, int sub_prio, int pre_prio);
static inline __attribute__((optimize(0))) void preemption(void)
{
cli();
sti();
cli();
}
static inline umword_t intr_status(void)

View File

@@ -19,7 +19,7 @@
#include "string.h"
typedef struct entry_frame_tmp
{
umword_t r[6];
umword_t r[8];
} entry_frame_tmp_t;
static void syscall_entry_raw(entry_frame_tmp_t entry);

View File

@@ -124,8 +124,8 @@ void arch_set_enable_irq_prio(int inx, int sub_prio, int pre_prio);
static inline __attribute__((optimize(0))) void preemption(void)
{
cli();
sti();
cli();
}
static inline umword_t intr_status(void)

View File

@@ -124,8 +124,8 @@ void arch_set_enable_irq_prio(int inx, int sub_prio, int pre_prio);
static inline void preemption(void)
{
cli();
sti();
cli();
}
static inline umword_t intr_status(void)

View File

@@ -57,8 +57,13 @@ typedef struct msg_tag
.msg_buf_len = (msg_words), \
.map_buf_len = (buf_words), \
.prot = (p)})
#if ARCH_WORD_SIZE == 64
#define msg_tag_get_prot(tag) \
((int)((tag).prot))
#else
#define msg_tag_get_prot(tag) \
((short)((tag).prot))
#endif
#define msg_tag_get_val(tag) msg_tag_get_prot(tag)
typedef union syscall_prot

View File

@@ -233,6 +233,6 @@ void start_kernel(void)
while (1)
{
knl_main();
// knl_main();
}
}

View File

@@ -4,8 +4,10 @@
# export TOOLCHAIN_LIB=/home/zhangzheng/mkrtos-tools/gcc/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/gcc-arm-none-eabi-10.3-2021.10/bin/
export TOOLCHAIN_LIB=/home/zhangzheng/gcc-arm/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/gcc-arm-none-eabi-10.3-2021.10/bin/
# export TOOLCHAIN_LIB=/home/zhangzheng/gcc-arm/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 BOARD=STM32F205
export CROSS_COMPILE_NAME=arm-none-eabi-

View File

@@ -1,9 +1,9 @@
#!/bin/bash
export TOOLCHAIN=/home/zhangzheng/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf/bin/
export TOOLCHAIN_LIB=/home/zhangzheng/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf/lib/gcc/aarch64-none-elf/10.3.1
# export TOOLCHAIN=/home/mkrtos-smart/toolchains/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin/
# export TOOLCHAIN_LIB=/home/mkrtos-smart/toolchains/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/lib/gcc/aarch64-none-elf/10.3.1
# export TOOLCHAIN=/home/zhangzheng/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf/bin/
# export TOOLCHAIN_LIB=/home/zhangzheng/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf/lib/gcc/aarch64-none-elf/10.3.1
export TOOLCHAIN=/home/mkrtos-smart/toolchains/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin/
export TOOLCHAIN_LIB=/home/mkrtos-smart/toolchains/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/lib/gcc/aarch64-none-elf/10.3.1
export BOARD=aarch64_qemu
export CROSS_COMPILE_NAME=aarch64-none-elf-

View File

@@ -13,7 +13,7 @@ if (${CONFIG_ARCH} STREQUAL "cortex-m3" OR
-fPIC -fPIE -n -pie -fpie -fpic -msingle-pic-base -mno-pic-data-is-text-relative \
" )
set(CORTEX_M_LINK_FLAGS "-pie")
set(CORTEX_M_LINK_FLAGS " -pie ")
set(LIBC_NAME "muslc")
set(ARCH_NAME "armv7_8m")

View File

@@ -14,3 +14,6 @@
#define ARCH_REG_5 "x5"
#define ARCH_REG_6 "x6"
#define ARCH_REG_7 "x7"
#define ARCH_WORD_SIZE 64

View File

@@ -19,3 +19,6 @@
#define ARCH_REG_5 "r5"
#define ARCH_REG_6 "r6"
#define ARCH_REG_7 "r7"
#define ARCH_WORD_SIZE 32

View File

@@ -47,8 +47,13 @@ typedef union msg_tag
.msg_buf_len = (msg_words), \
.map_buf_len = (buf_words), \
.prot = (p)})
#if ARCH_WORD_SIZE == 64
#define msg_tag_get_prot(tag) \
((int)((tag).prot))
#else
#define msg_tag_get_prot(tag) \
((short)((tag).prot))
#endif
#define msg_tag_get_val(tag) msg_tag_get_prot(tag)
typedef union syscall_prot

View File

@@ -16,7 +16,7 @@
#include <u_thread_util.h>
#include <u_thread.h>
static ATTR_ALIGN(8) uint8_t cons_stack[4096];
static ATTR_ALIGN(8) uint8_t cons_stack[1024];
// static uint8_t cons_msg_buf[MSG_BUG_LEN];
static cons_t cons_obj;
static obj_handler_t cons_th;
@@ -49,7 +49,7 @@ void console_init(void)
cons_svr_obj_init(&cons_obj);
meta_reg_svr_obj(&cons_obj.svr, CONS_PROT);
u_thread_create(&cons_th, (char *)cons_stack + sizeof(cons_stack) - 8, NULL, console_read_func);
u_thread_run(cons_th, 3);
u_thread_run(cons_th, 2);
ulog_write_str(LOG_PROT, "cons svr init...\n");
}
/**

View File

@@ -1,7 +1,7 @@
#一次读取一行,每行代表启动的应用程序,暂时不支持参数
# fatfs
cpiofs
# cpiofs
# dm9000_drv
# net
sh

View File

@@ -48,6 +48,8 @@ add_custom_target(
mkdir -p ${CMAKE_SOURCE_DIR}/build/output/cpio
COMMAND
cp sh.bin ${CMAKE_SOURCE_DIR}/build/output/cpio/sh
COMMAND
cp sh.elf ${CMAKE_SOURCE_DIR}/build/output/sh.elf
)
if ((DEFINED CONFIG_ELF_LAUNCH) AND (CONFIG_ELF_LAUNCH STREQUAL "y"))
add_custom_target(