| Electronics > Projects, Designs, and Technical Stuff |
| How to modify code in micro controller during mass production? |
| << < (3/3) |
| sokoloff:
I think I have 52 bytes of program code space available in my production code, so nowhere near enough for the serial serializing code. |
| ajb:
Another option is to instruct the MCU itself write the data, which works very well if you already have a test bench that talks to the MCU via UART or whatever for production testing. This could be the last page of flash if you have the space to spare, otherwise you could have the MCU rewrite an existing page, which would be a little more dicey, and you'd want a verification step for sure, but wouldn't consume any extra program space. Some MCUs also have EEPROM or specific configuration pages in flash that could also work. Really it's impossible to give a definitive answer given how unconstrained the question is. The best solution depends on the amount of data that must be stored, the MCU, the type of production infrastructure already in place, etc. |
| rstofer:
In the linker memory map, it is common to block out high address areas of flash. You could load your uC with code to get the data from somewhere and put it in the dedicated block and then program your device with production code. Assuming you have broken out the UART. Your linker script should provide a variable containing the address and perhaps your startup code could have a short bit of code that returned the address to your main program. I would be hesitant to hardwire the address into the main code. Things move! Or, you can have a Makefile (or something) that generates the table information and then just use your regular programmer to put it where it belongs and then on a separate pass, write the production code. Or have the Makefile munge the main code with the table data (generated by the Makefile) before programming. Lots of ways to skin this cat. |
| Navigation |
| Message Index |
| Previous page |