Add 256/64 build

This commit is contained in:
Sergey Lyubka 2024-01-21 12:49:57 +00:00
parent f883504d2d
commit 3880300cd9
2 changed files with 13 additions and 5 deletions

View File

@ -1,3 +1,7 @@
# By default, this firmware is built with 288/32 flash/ram device configuration
# To build it with 256/64 configuration, run the following:
# make CFLAGS_EXTRA="-Wl,--defsym -Wl,RAM_64K=1"
ROOT ?= $(realpath $(PWD)/../../..)
PREFIX ?= riscv-none-elf
#PREFIX ?= docker run --platform linux/amd64 --rm -it -v$(ROOT):$(ROOT) -w $(PWD) mdashnet/riscv riscv-none-elf
@ -5,7 +9,7 @@ CFLAGS = -W -Wall -Wextra -Wundef -Wshadow -Wdouble-promotion
CFLAGS += -Wformat-truncation -Wconversion -Wno-sign-conversion
CFLAGS += -ffunction-sections -fdata-sections -fno-common
CFLAGS += -DSYSCLK_FREQ_144MHz_HSE -I. -Ivendor -g3 -Os
CFLAGS += -march=rv32imafc -mabi=ilp32 $(CFLAGS_EXTRA)
CFLAGS += -march=rv32imafc -mabi=ilp32
LDFLAGS = -T vendor/link.ld -nostartfiles --specs=nano.specs --specs=nosys.specs -Wl,--gc-sections
SOURCES = hal.c main.c mongoose.c net.c packed_fs.c
SOURCES += vendor/system_ch32v30x.c vendor/startup_ch32v30x_D8C.S
@ -24,7 +28,7 @@ firmware.bin: firmware.elf
$(PREFIX)-size --format=berkeley $<
firmware.elf: $(SOURCES) hal.h mongoose_custom.h Makefile
$(PREFIX)-gcc $(SOURCES) $(CFLAGS) $(LDFLAGS) -o $@
$(PREFIX)-gcc $(SOURCES) $(CFLAGS) $(LDFLAGS) $(CFLAGS_EXTRA) -o $@
flash: firmware.bin
wchisp flash $<

View File

@ -3,9 +3,13 @@ __stack_size = 4096;
PROVIDE( _stack_size = __stack_size );
MEMORY {
/* Possible configurations: 192/128, 224/96, 256/64, 288/32 */
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 288k
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32k
/*
* Possible configurations: 192/128, 224/96, 256/64, 288/32
* By default, we're building with 288/32 configuration
* To build with 256/64, add -Wl,--defsym=RAM_64K=1
*/
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = DEFINED(RAM_64K) ? 256k : 288k
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = DEFINED(RAM_64K) ? 64k : 32k
}
SECTIONS {