change build project name and add some docs

This commit is contained in:
yelvlab 2024-09-21 12:37:15 +08:00
parent b7b439f611
commit 94d4ffa136
9 changed files with 39 additions and 9 deletions

View File

@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.28)
include(cmake/toolchain.cmake)
project(gd32e23_template)
project(gd32e23x_template)
enable_language(C)
enable_language(CXX)
@ -10,7 +10,7 @@ enable_language(ASM)
# Use custom startup.S
set(TARGET_STARTUP_ASM ${CMAKE_SOURCE_DIR}/startup/startup_gd32e23x.S)
# Use custom linker script
set(TARGET_LD_SCRIPT ${CMAKE_SOURCE_DIR}/ld/gd_e230f4_gcc.ld)
set(TARGET_LD_SCRIPT ${CMAKE_SOURCE_DIR}/ld/gd32e23x_gcc.ld)
# Add GD SDK
add_subdirectory(sdk)
@ -21,11 +21,11 @@ set(TARGET_C_SRC
${CMAKE_SOURCE_DIR}/src/wc_bldc_control.c
)
add_executable(gd32e23_template ${TARGET_C_SRC})
add_executable(gd32e23x_template ${TARGET_C_SRC})
target_link_libraries(gd32e23_template GD32E23X_SDK)
target_include_directories(gd32e23_template PUBLIC inc)
target_link_libraries(gd32e23x_template GD32E23X_SDK)
target_include_directories(gd32e23x_template PUBLIC inc)
# Generate .bin and .hex
generate_binary_file(gd32e23_template)
generate_hex_file(gd32e23_template)
generate_binary_file(gd32e23x_template)
generate_hex_file(gd32e23x_template)

View File

@ -1,2 +1,34 @@
# gd32_temp
from mo10
## 关于链接脚本
注意芯片选型, 不同型号的芯片 FLASH 和 RAM 大小不同。需要修改链接脚本`ld/gd32e23x_gcc.ld`
| 芯片型号 | FLASH | RAM |
|------------|-------|-----|
| GD32E230F4 | 16K | 4K |
| GD32E230F8 | 64K | 8K |
```linkerscript
/* memory map */
MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 16K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 4K
}
```
## Ref
1. 参考LD/Startup
[https://github.com/Noveren/gd32e23x-template/blob/main/gd32e23x/template/linker.ld](https://github.com/Noveren/gd32e23x-template/blob/main/gd32e23x/template/linker.ld)
[https://github.com/Noveren/gd32e23x-template/blob/main/gd32e23x/template/startup.s](https://github.com/Noveren/gd32e23x-template/blob/main/gd32e23x/template/startup.s)
2. 官方LD/Startup
使用Embedded Builder工具生成的C标准库生成的模板

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -4,7 +4,6 @@
\version 2024-02-22, V2.1.0, firmware for GD32E23x
*/
#include "main.h"
#include <stdio.h>
#include "gd32e23x.h"
@ -20,7 +19,6 @@
\param[out] none
\retval none
*/
int main(void)
{
/* configure systick */