This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28027F: Serial flash programming with CSM enabled

Part Number: TMS320F28027F


I need to implement firmware update through SCI with code security enabled. I use serial_flash_kernel example: first it is loaded into RAM with ROM bootloader. Then flash kernel gets application file through SCI and programs into flash. The issue is that ROM bootloader can't load data into L0 and L1 while the device is locked by CSM. This is confirmed in
Serial Flash Programming of C2000™ Microcontrollers doc http://www.ti.com/lit/an/sprabv4c/sprabv4c.pdf


"The ROM cannot access RAM protected by the Code Security Module (CSM). Therefore, the device needs to be unlocked, or the load must be to unsecure RAM."

Unsecure RAM is M0 and M1 which is tiny - only 2kB and serial_flash_kernel does not fit into it. In cmd file which goes with serial_flash_kernel .text and some more data is put int L0 and L1, does it make sense if CSM enabled? How is firmware update with CSM enabled supposed to be working? 

  • I don't believe this is possible.

    The approach is to do the entire upgrade without unlocking the device. You will have a custom bootloader in one or more of the Flash sectors. This will perform the firmware upgrade on the Flash sectors where the application is stored. Flash APIs will have to be in Flash (not ROM) and be copied to Secure RAM from where they can program/erase secure Flash sectors without unlocking the device.

    Chris, feel free to comment.

    Thanks,

    Sira

  • Hi Sira

    Thank you. That is a good idea. Although there is not much flash, and the sector's are big - the whole page of  16kb has to be allocated for serial flash programmer.

    I was able to barely fit f28027_flash_kernel in m0 m1 and it unlocked csm, and worked. But I need more space for PCb revision code.

    I think flash kernel in Flash is much better for reverse engineering protection. But it also enables programming any application firmware.

    Ram flash kernel which may unlock csm serves as a "key" - only having this key you may update application firmware. Also you can modify flash kernel and it does not take flash space at all.

  • Thanks for the feedback.

    Just so I understand you correctly, are you saying "Bootloader in Flash is much Easier to reverse engineer"?

    Let me know how else I can help.

    Thanks,

    Sira

  • I meant the opposite - bootloader in flash is harder to reverse and better for protection. Is there a ready example of flash bootloader? Or I should move f28027_flash_kernel from ram to flash?

  • I checked and it looks like the f28027_flash_kernel does not come with both RAM and FLASH build configurations, just RAM. So you will have to generate the other one yourself.

    Thanks,

    Sira