Tool/software:
Hi,
I have associated all the flash sectors of TMS320F280025 to Zone 1 of the DCSM (LSRAMs are unsecure, they are not part of Zone1).
I have implemented a custom bootloader that receives blocks of 1024Word from Modbus and writes them, via the flash API, inside the flash sectors.
As explained in the Reference Guide of the flash API, for the correct programming of the flash, the code of bootloader must reside in RAM.
In my case I cannot also associate the RAMs to Zone1 of the DCSM (for reasons that I will not specify here) and therefore in order to erase/program the flash sectors (which are part of Zone1) I must first unsecure Zone1.
To make the process as secure as possible, I unsecure Zone1 an instruction before using the Flash API for erasing/programming and re-secure it as soon as the writing has been successful.
Then I will unsecure Zone1 when I will receive next 1024words from Modbus and secure it after their programming in flash and so on until the end of the new firmware words.
To unsecure Zone1 I use the function DCSM_unlockZone1CSM(DCSM_CSMPasswordKey) and to secure it I use the function DCSM_secureZone1().
The problem is that once I call the DCSM_secureZone1() function, the ALLZERO bit in the control register (Z1_CR) is raised and all subsequent calls to the DCSM_unlockZone1CSM(DCSM_CSMPasswordKey) function do not unsecure Zone1 again (the ARMED and UNSECURE bits of Z1_CR are not set as they are the first time the DCSM_unlockZone1CSM(DCSM_CSMPasswordKey) function is called) and I can't figure out why.
Before calling the DCSM_unlockZone1CSM(DCSM_CSMPasswordKey) function I also call the Flash_disableCache() function, as specified in the TRM.
At the moment the solution to this problem is to unsecure Zone1 at the beginning (when the bootloader is activated) and leave it unsecure until uC resets itself (after all the 1024Word blocks with the new firmware are received and programmed in flash).
This solution is not very secure.
Another question about the DCSM is that I would like to know how to program the OTP memory without Code Composer.
To do some tests, now I connected Code Composer via JTAG to the DSP and manually programmed the CSM password, linkpointer, grabsect via the menu Tools -> On-Chip Flash menu but it is unthinkable to do this in production.
When I have a new uC how do I program the OTP memory without using Code Composer? I had thought of using the C2Prog tool (I tried but I can't program the OTP of a new device).
Maybe it is possible to do it only using the UniFlash tool? In addition, in a uC with an older firmware (not equipped with DCSM), how do I program the CSM password, linkpointer, grabsect inside the OTP memory from within the firmware itself (my custom bootloader)? Can I use Flash APIs?
Best regards,
Davide.