platformio/platform-intel_mcs51

How to make it support board_build_offfset option for stc 51 mcu?

Closed this issue · 2 comments

I want to change the start address of the HEX file after build for IAP function, but I don't find a method to change the start address in platformIO. In keil or IAR, it's easy to change its ROM start address in target tab of project option.

Compiler/linker is sdcc, so you can look at the options they provide for mcs51 targets.
I believe there was some limited control over some of this.
See sections
3.3.5 Linker Options
3.3.6 MCS51 Options
http://sdcc.sourceforge.net/doc/sdccman.pdf
note that this is the latest 4.1.x manual, and that may not be what is currently packaged w/ platform "Intel MCS-51" (this)
I believe it's currently toolchain-sdcc containing sdcc 3.8.4

Also, due to the platformio "wrapper" around the toolchain (i.e. compilation & linking), some things can be passed, but others may not. (It has been a long while since I played around with passing exotic sdcc options, but I recall having to resort to custom build scripts to modify some lower-level linker options, etc.. Ref: https://docs.platformio.org/en/latest/projectconf/advanced_scripting.html#extra-linker-flags-without-wl-prefix)

OK, I found the SDDC has an option named "--codec-loc", it can set the start location of the code segment,
I have been tried and it works, although it came out a new probelm that the address of the interrupt vetor table can't be changed in my MCU.