Repository navigation
C3 for MCU programming: evaluation #3632
Replies: 1 comment 1 reply
|
I found out why --gc-sections didn't remove a bunch of routines and data in my linked elf that I was not referencing in any way. Those routines all come from the C3 runtime that is embedded in the library that c3c generates. While my code doesn't reference any part of the runtime directly (in this example), the reason it keeps about 28/30 KB of unreferenced code and 4 KB of unreferenced data, in spite of compiling with "-function-sections=yes --data-sections=yes" and linking with "--gc-sections", is that it seems that LLVM emits all of those symbols with the "Retain" flag, preventing the linker GC to remove the unreferenced ones. It's all the symbols that have the AXGR attribute flags. (R = Retain) |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I started evaluating C3 for embedded development. Since it supports RV32, I started with a test for a RISC-V 32-bit MCU (WCH CH32V307).
Here is how I approached it first:
So far, so good. The resulting firmware seems to work as intended.
Now, here are my findings:
The good:
The annoying / could be improved:
@interruptattribute, that would generate a target-dependent (if required) prologue and epilogue for interrupt routines, would be useful. At the moment, we can write the ISR in C or assembly and have it call a, exported C3 function. Slightly less efficient.The bugs:
All reactions