Skip to content

Commit aeb21c2

Browse files
committed
correct flash/ram for v307 and v305
1 parent 9005f12 commit aeb21c2

File tree

8 files changed

+31
-22
lines changed

8 files changed

+31
-22
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ body:
8686

8787
- type: checkboxes
8888
attributes:
89-
label: I have checked existing issues, dicussion and documentation
89+
label: I have checked existing issues, discussion and documentation
9090
description: You agree to check all the resources above before opening a new issue.
9191
options:
92-
- label: I confirm I have checked existing issues, dicussion and documentation.
92+
- label: I confirm I have checked existing issues, discussion and documentation.
9393
required: true
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1+
set(LD_FLASH_SIZE 256K)
2+
set(LD_RAM_SIZE 64K)
3+
14
function(update_board TARGET)
2-
# target_compile_definitions(${TARGET} PUBLIC
3-
# )
45
endfunction()
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
LD_FILE = $(FAMILY_PATH)/ch32v307.ld
1+
LDFLAGS += \
2+
-Wl,--defsym=__FLASH_SIZE=256K \
3+
-Wl,--defsym=__RAM_SIZE=64K \
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1+
set(LD_FLASH_SIZE 128K)
2+
set(LD_RAM_SIZE 32K)
3+
14
function(update_board TARGET)
2-
# target_compile_definitions(${TARGET} PUBLIC
3-
# )
45
endfunction()
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
LD_FILE = $(FAMILY_PATH)/ch32v307.ld
1+
LDFLAGS += \
2+
-Wl,--defsym=__FLASH_SIZE=128K \
3+
-Wl,--defsym=__RAM_SIZE=32K \

hw/bsp/ch32v30x/family.cmake

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function(add_board_target BOARD_TARGET)
2929
endif()
3030

3131
if (NOT DEFINED LD_FILE_GNU)
32-
set(LD_FILE_GNU ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/ch32v307.ld)
32+
set(LD_FILE_GNU ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/linker/ch32v30x.ld)
3333
endif ()
3434
set(LD_FILE_Clang ${LD_FILE_GNU})
3535

@@ -74,12 +74,14 @@ function(add_board_target BOARD_TARGET)
7474
-fsigned-char
7575
)
7676
target_link_options(${BOARD_TARGET} PUBLIC
77-
"LINKER:--script=${LD_FILE_GNU}"
7877
-nostartfiles
7978
--specs=nosys.specs --specs=nano.specs
79+
-Wl,--defsym=__FLASH_SIZE=${LD_FLASH_SIZE}
80+
-Wl,--defsym=__RAM_SIZE=${LD_RAM_SIZE}
81+
"LINKER:--script=${LD_FILE_GNU}"
8082
)
8183
elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
82-
message(FATAL_ERROR "Clang is not supported for MSP432E4")
84+
message(FATAL_ERROR "Clang is not supported for CH32v")
8385
elseif (CMAKE_C_COMPILER_ID STREQUAL "IAR")
8486
target_link_options(${BOARD_TARGET} PUBLIC
8587
"LINKER:--config=${LD_FILE_IAR}"
@@ -120,9 +122,8 @@ function(family_configure_example TARGET RTOS)
120122
)
121123
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
122124

123-
124-
125125
# Flashing
126126
family_add_bin_hex(${TARGET})
127127
family_flash_openocd_wch(${TARGET})
128+
family_flash_wlink_rs(${TARGET})
128129
endfunction()

hw/bsp/ch32v30x/family.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ INC += \
5757
$(TOP)/$(SDK_SRC_DIR)/Core \
5858
$(TOP)/$(SDK_SRC_DIR)/Peripheral/inc
5959

60+
LD_FILE ?= $(FAMILY_PATH)/linker/ch32v30x.ld
61+
6062
# For freeRTOS port source
6163
FREERTOS_PORTABLE_SRC = $(FREERTOS_PORTABLE_PATH)/RISC-V
6264

hw/bsp/ch32v30x/ch32v307.ld renamed to hw/bsp/ch32v30x/linker/ch32v30x.ld

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
ENTRY( _start )
2-
3-
__stack_size = 4096;
4-
5-
PROVIDE( _stack_size = __stack_size );
6-
1+
/* Define default values if not already defined */
2+
__flash_size = DEFINED(__FLASH_SIZE) ? __FLASH_SIZE : 128K;
3+
__ram_size = DEFINED(__RAM_SIZE) ? __RAM_SIZE : 32K;
4+
__stack_size = DEFINED(__STACK_SIZE) ? __STACK_SIZE : 2048;
75

86
MEMORY
97
{
10-
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 288K
11-
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K
8+
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = __flash_size
9+
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = __ram_size
1210
}
1311

12+
ENTRY( _start )
13+
14+
PROVIDE( _stack_size = __stack_size );
1415

1516
SECTIONS
1617
{
17-
1818
.init :
1919
{
2020
_sinit = .;

0 commit comments

Comments
 (0)