minichlink can printf()!!#
Use minichlink -T through which you can recieve UART. You can now use
printf()(comes with ch32fun.c) and it will send its output via the single DIO
line.
Learn to read .map files for a simple blink program#
-
*(SORT_NONE(.init))is part of linker script. It will catch all section names.initand places them in the exact order they were passed to the linker. For example there could be one in main, one inside another library etc. -
This chip supports commpressed instruction meaning instead of the usual 4 byte instructions it can be compressed into 2 bytes. An exeption is the
.initsection which has interrupt defaults and requires strictly 4 bytes addressing. So we useALIGN(0x4). There are other places where you have to use 4 bytes alignment such as in RAM(.data&.bss) and.rodata.
TODO:#
- Split the flash
- Bootloader runs some needed config
- Recieve user code (could be implemented last; test it with a dummy in flash program first)
- Write user code to flash safely
- Redirect interrupt vector table to user code
- Jump to user code