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.
Hi,
I am using the TMDXDOCKH52C1 development kit with CCS4. I am coding in C++ because I need to use objects in my programming. However when I try to create a new object (either from the heap or not) I get a linker error: "placement fails for object ".text", size 0x238e (page 0). Available ranges: C0 size: 0x2000 unused: 0x2000 max hole: 0x2000". I have checked the ".map" file and the linker is trying to put the 0x238e ".text" file into the C0 memory region which is only 0x2000 big.
Can anyone answer why it is (attempting to) go into the C0 location? From what I understand, ".text" refers to the code, and I thought this was meant to be stored in flash memory?
Thanks,
Tom
Tom Brown said:Hi,
I am using the TMDXDOCKH52C1 development kit with CCS4. I am coding in C++ because I need to use objects in my programming. However when I try to create a new object (either from the heap or not) I get a linker error: "placement fails for object ".text", size 0x238e (page 0). Available ranges: C0 size: 0x2000 unused: 0x2000 max hole: 0x2000". I have checked the ".map" file and the linker is trying to put the 0x238e ".text" file into the C0 memory region which is only 0x2000 big.
Can anyone answer why it is (attempting to) go into the C0 location? From what I understand, ".text" refers to the code, and I thought this was meant to be stored in flash memory?
Thanks,
Tom
Tom,
The .cmd file in the project tells the compiler how to allocate the different sections. In general our examples are RAM based just to make debug faster. Eventually, yes, .text should be stored in flash.
This wiki article talks a bit more about the .cmd file and how you can expand the .text region or move it if needed:
http://processors.wiki.ti.com/index.php/C28x_Compiler_-_Understanding_Linking
Regards
Lori
Hi Lori, thanks for your reply.
Could you advise me on how best to do this? I first tried changing the .text section to be stored in Flash memory, then I encountered another error:
"placement fails for object ".resetisr", size 0x6 (page 0). Available ranges: RESETISR size: 0x8 unused: 0x8 max hole: 0x8"
After reading the FAQ on the link you sent me I think this may be to do with the memory being "blocked" and failing to fit within one page.
I tried resizing the Resetisr memory block but then encountered a similar error with the .cinit section which did not fit into C2. I set the .cinit section to be allocated in both C2 and C0.
This compiled, but I encountered horrible errors when I tried to load the program onto the chip, like "Failed to load program - reason: Cannot write to target" and "Error found during data verification. Ensure the linker command file matches the memory map."
I noticed that at the top of the cmd file there is this text "Linker Command File for F28M35M52C1 examples that run out of RAM. This ONLY includes all SARAM blocks on the F28M35M52C1 device. This does not include flash or OTP. Keep in mind that C0 and C1 are protected by the code security module. What this means is in most cases you will want to move to another memory map file which has more memory defined."
This implies there is a standard fix which can be done to fix these errors I am encountering - I return to my very first question: could you advise me on how best to do this?
Thanks in advance,
Tom
Tom Brown said:I first tried changing the .text section to be stored in Flash memory, then I encountered another error:
"placement fails for object ".resetisr", size 0x6 (page 0). Available ranges: RESETISR size: 0x8 unused: 0x8 max hole: 0x8"
Tom,
I did some research and found out the .resetisr section has to be within +/- 16 MB of the init routine which it branches to.
Basically what this means is if the _c_init00 section is moved to flash (it is part of the .text section) the .resetisr section also needs to be moved to flash.
I am attaching a linker .cmd file that only uses RAM and has additional memory allocation for .text. Can you try it out and see if it resolves your issue.
I advise sticking with RAM for your initial development. We are still working on flash examples and there are known issues with the flash plug-in in the current CCS
(refer to this post: https://e2e.ti.com/support/microcontrollers/tms320c2000_32-bit_real-time_mcus/int-tms320c2000_champs/f/175/t/126822.aspx)
If you still want to work with flash, I am also attaching a flash based command file for you. The next controlSUITE update (end of August) will have both flash and RAM linker command files for the M3 and the 28x.
6012.F28M35x_generic_wshared_M3_RAM_example.zip.
Regards,
Lori
Hi, I tried using the "F28M35x_generaic_wshared_M3_RAM_example.cmd" file, and the project compiled.
However, upon loading the program to the board, I encountered the error:
"Failed to load program ' .. ' on target ... '. Reason: Error found during data verification. Ensure the linker command file matches the memory map. Refer to the Console View for specific address information."
The Console says:
"Cortex_M3_0: File Loader: Data verification failed at address 0x20000000 Please verify target memory and memory map.
Cortex_M3_0: Warning: (Error -1003 @ 0x2BC5) Internal error: Invalid parameter passed to function. Restart the application. If error persists, please report the error. (Release 5.0.429.0)
Error found during data verification."
I am thinking of using LM Flash Programmer to unlock the debug port, I don't know whether this will help. Unfortunately although I knew which settings to use for a a previous board, I do not know how to unlock this one!
Tom
Tom Brown said:Hi, I tried using the "F28M35x_generaic_wshared_M3_RAM_example.cmd" file, and the project compiled.
However, upon loading the program to the board, I encountered the error:
"Failed to load program ' .. ' on target ... '. Reason: Error found during data verification. Ensure the linker command file matches the memory map. Refer to the Console View for specific address information."
The Console says:
"Cortex_M3_0: File Loader: Data verification failed at address 0x20000000 Please verify target memory and memory map.
Cortex_M3_0: Warning: (Error -1003 @ 0x2BC5) Internal error: Invalid parameter passed to function. Restart the application. If error persists, please report the error. (Release 5.0.429.0)
Error found during data verification."
I am thinking of using LM Flash Programmer to unlock the debug port, I don't know whether this will help. Unfortunately although I knew which settings to use for a a previous board, I do not know how to unlock this one!
Tom
Tom,
The CCS .gel file should be unlocking the CSM - I'm not sure why it is not. I've attached the latest gel file that the team has been working on. Can you try it out and see if it helps. It will go into the CCS directory under emulation/gel.
This will also create unlock menus in CCS as shown below:
Another thing to try is see if you can write to this block through a memory window in CCS.
Hi Lori,
I have replaced the .gel file with the one you provided and still with no luck.
I also tried using the Security Scripts though was unsure which to select, so tried all of them. However I am stil encountering the same error!
What do you mean by a memory window in CCS?
Thanks, Tom
Hi Tom,
F28M35x device that you are using is an early released TMX device. Flash might not be in an erased state in these devices. So, the password locations in the Flash might have some data (other than all 1s) programmed and hence the device is not getting unlocked for you. You can open a memory window in CCS (using a memory window in CCS, you will be able to look at the contents of any Flash/RAM/Register memory space mapped to that core) by navigating through the menu bar tabs located at the top left corner of CCS: View --> Memory.
In memory window, type the Flash password address location in hex format and you will be able to look at the values in the password location.
128bit Password locations for M3, Zone 1: 0x200000, 0x200004, 0x200008 and 0x20000C
128bit Password locations for M3, Zone 2: 0x27FFF0, 0x27FFF4, 0x27FFF8 and 0x27FFFC
128bit Password locations for C28x: 0x13FFF8, 0x13FFFA, 0x13FFFC and 0x13FFFE
Copy the password from the password locations and paste it in CSM KEY fields of Flash plug-in (Flash plugin for F28M35x devices is available in CCS version 4.2.4.00029 or later) and unlock the device. Once device gets unlocked, erase the Flash using plug-in. Once Flash is erased, gel reset function or security related scripts in CCS should be able to unlock the device.
If you don't have the CCS version which has Flash plugin to unlock the device, you can edit the Unlock_CSM functions in gel files to reflect the passwords you see in password locations in memory window. For example, in memory window, if you see that the password for M3 Zone 1 as 0xAAAAAAAA, 0x55555555, 0xAAAAAAAA, 0x55555555 at address locations 0x200000, 0x200004, 0x200008 and 0x20000C. Then you need to modify the Unlock_CSMZ1 funtion as shown below. Changes are highlighted in yellow.
hotmenu Unlock_CSMZ1()
{
/* Perform dummy reads of the password locations */
R1 = *0x200000;
R1 = *0x200004;
R1 = *0x200008;
R1 = *0x20000C;
/* Write passwords to the KEY registers. 0xFFFFFFFF's are dummy passwords.
User should replace them with the correct password for their DSP */
*0x400FB400 = 0xAAAAAAAA;
*0x400FB404 = 0x55555555;
Reload the gel file and do a debugger reset after such modification and device should get unlocked. But still you may not be able to load code in to device depending on the values in other security related registers like GRABRAM and GRABSECT (We can explain if needed once you try above stuff). So, we suggest you to update the CCS to get the Flash plugin and erase the flash and the gel files would work with out any modification.
Thanks and regards,
Vamsi
For some reason, some contents of Unlock_CSMZ1 function that I posted above are lost once I posted the content on forum. Below is the example for modified Unlock_CSMZ1 function:
Remember to revert back to original gel function once you erase your device.
Thanks and regards,
Vamsi
hotmenu Unlock_CSMZ1()
{
/* Perform dummy reads of the password locations */
R1 = *0x200000;
R1 = *0x200004;
R1 = *0x200008;
R1 = *0x20000C;
/* Write passwords to the KEY registers. 0xFFFFFFFF's are dummy passwords.
User should replace them with the correct password for their DSP */
*0x400FB400 = 0xAAAAAAAA;
*0x400FB404 = 0x55555555;
*0x400FB408 = 0xAAAAAAAA;
*0x400FB40C = 0x55555555;
}
Hi,
Thank you so much for your comprehensive help and advice. Fortunately I do have the later version of CCS so have the Flash unlocker plugin.
I found the passwords in the memory map, and pasted them into the unlock part of the on chip flash utility. However upon clicking unlock, I got the error "Error executing Flash Operation" and a message in the console saying:
"Cortex_M3_0: Performing Security Operation...
Cortex_M3_0: Device unlock failed. Device is still locked. Please check the provided password."
I have checked the passwords and I'm sure they are correct. Can I check in which format I meant to be reading them - I assume it is meant to be Hex 32bit (TI style).
Tom
Tom,
You are almost there:-).
Error that you are getting is a known issue with F28M35x Flash plugin. Please look at the Item 3 in Known flash plug-in issues at this forum thread: http://e2e.ti.com/support/microcontrollers/tms320c2000_32-bit_real-time_mcus/f/171/t/126824.aspx
You are correct that you can read in hex 32bit (TI Style) format.
Thanks and regards,
Vamsi
Locking and then unlocking didn't work :(
Upon locking the console displays "Performing Security Operation...
Cortex_M3_0: Device is already locked.
Cortex_M3_0: Operation completed successfully."
But I get the same error as before when trying to unlock after doing that.
Item 4 looks like it may be relevant? How would I go about reading those registers in the way that the post describes?
Thanks, Tom
Tom,
Yes, try reading those registers after an unsuccessful unlock.
Then try to erase the flash using plugin.
Then try loading your code.
......
If above sequence does not help, please edit the Unlock_CSM function in gel file as I mentioned yesterday and then perform a debugger reset to unlock the device as I explained in earlier posts. Then erase flash using plugin.
Thanks and regards,
Vamsi
Well i'm not sure how, but I managed to unlock the device so thank you!
I tried resetting and repowering the board, using the flash plugin, editing the gel file and reading the registers and it suddenly worked, so I'm not sure what it was that fixed it.
Anyway, I am now using the .cmd file which you sent me and everything is working just fine, so thank you.
What would you recommend I do when my code gets too big for the RAM? Should I load it onto the flash and try debugging or will this crash?
Also, the .cmd file you sent me doesn't have a FLASH memory region defined, whereas the original did, so what line do I need to add to this file when Flash is needed?
Tom
Tom,
Good that it is working for you now.
As Lori mentioned: I advise sticking with RAM for your initial development. We are still working on flash examples and there are known issues with the flash plug-in in the current CCS (refer to this post: https://e2e.ti.com/support/microcontrollers/tms320c2000_32-bit_real-time_mcus/int-tms320c2000_champs/f/175/t/126822.aspx)
If you still want to work with flash, I am also attaching a flash based command file for you. The next controlSUITE update (end of August) will have both flash and RAM linker command files for the M3 and the 28x.
I am attaching flash based linker command file for you here. 4048.F28M35H52C1_FlashLinkerCmd.zip
As long as you does not program anything in password locations (they should be all 1s), you should not have any issues loading code in to RAM and Flash.
Thanks and regards,
Vamsi
I’ve got the same problem after trying to program code into the flash memory.
Modifying the .gel-File, using the flash-plug in, reading the registers (OTPSECLOCK, GRABSECT, GRABRAM) and erasing Flash worked to unlock the device.
Thank you all for the explicit description!
Best regards
Armin