Improve setting of configurable Flash + RAM sizes #20
Labels
bug
Something isn't working
documentation
Improvements or additions to documentation
enhancement
New feature or request
Very sneakily, some CH32V20x and CH32V30x chips have the capability for different Flash+SRAM configurations.
These seem to be programmed into the option bytes (through the flash peripheral).
Original linker scripts.
Currently we only hint at this in the
platformio.ini
for one chipplatform-ch32v/examples/blinky-none-os/platformio.ini
Lines 28 to 43 in f1eb50c
If the chip was configured to have one configuration (e.g., "FLASH-288K + RAM-32K") but the
platformio.ini
configuration builds a firmware for the "FLASH-256K + RAM-64K" configuration, the chip will fail too boot properly, because the linker script and startup file will place the initial stack pointer (SP) at the end of RAM (so e.g. 0x200000 + 64K) which is not RAM in the current configuration, so at the first usage of the stack (like ajal
instruction), the chip HardFault's.We need a way for these chips to readout the current Flash+SRAM configuration and check them against the used build config, then either throw a really big warning or straightup fail the build or upload process.
It would also be good if we had a way to set a desired configuration and have that available as a PlatformIO task (together with removing read/write protection locks).
Currently I've been doing this via the official W.CH ISP Programmer tools.
The text was updated successfully, but these errors were encountered: