alfin K

I plan to use this place to document my work, keep short notes for easy reference and write about things I might forget.

Project Log: ch32v006 UART bootloader


published
written by Alfin · category Embedded ·

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.

  • *(SORT_NONE(.init)) is part of linker script. It will catch all section names .init and 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 .init section which has interrupt defaults and requires strictly 4 bytes addressing. So we use ALIGN(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