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.

MSPM0G3507: Placing firmware on alternative address bricks the controller.

Part Number: MSPM0G3507
Other Parts Discussed in Thread: SYSCONFIG

Dear all,
I currently bricked some controllers caused by trying to debug a firmware not placed at address 0x0. We use a custom bootloader and hence placed the firmware at a different address. The memory layout is as follows:

  • The bootloader is placed at the lower 8k flash memory (0x0000 - 0x1fff)
  • The firmware is placed just behind the bootloader (0x2000 - 0xb7ff)
  • After power-up/reset the bootloader is started and jumps to the firmware.

The following works fine:

  • Install the firmware using an XDS110 and place it at address 0x0
  • Install the bootloader using an XDS110 and place it at address 0x0
  • Install the bootloader using an XDS110 and install the firmware to address 0x2000 using the bootloader (addresses are adjusted in the linker script and the firmware recompiled)
    • -> After a reset our custom bootloader is started which in turn starts the firmware.

However, trying to debug our firmware while it is placed at address 0x2000 seems to brick the controller.

Steps to reproduce:

  • Build and install our custom bootloader (address 0x0)
  • Build firmware (linker script places the firmware at address 0x2000)
  • Configure the debugger to NOT erase the bootloader

  • Start debugging

I expect the following behavior:

  • CCS/XDS110 erase the configured flash sectors and download the firmware
  • CCS/XDS110 set a breakpoint at "main()" and issue a reset
  • Upon reset our custom bootloader is started which in turn jumps to the firmware
  • The firmware holds at "main" and CCS/XDS110 gain control

However, the actual behavior is as follows:

  • CCS/XDS110 override the bootloader (line 7)
  • CCS/XDS110 download the firmware (line 11-50)
  • Debugging fails with errors -1001 and -2064 (lines 51 till the end).

CORTEX_M0P: GEL Output: Memory Map Initialization Complete
CORTEX_M0P: Flash Programmer: Verbose output enabled
CORTEX_M0P: Flash Programmer: DLL Version 1.4.1.0 
CORTEX_M0P: Flash Programmer: FlashResetBeforeLoadSetting = 1
CORTEX_M0P: Flash Programmer: FlashResetType = Hard reset
CORTEX_M0P: Flash Programmer: Hard reset before programming
CORTEX_M0P: Writing Flash @ Address 0x00000000 of Length 0x00002988
CORTEX_M0P: Flash Programmer: Uploading RAM loader to device
CORTEX_M0P: Flash Programmer: RAM loader returned after 10 ms 
CORTEX_M0P: Flash Programmer: Device init finished
CORTEX_M0P: Flash Programmer: Erasing main memory by sectors
CORTEX_M0P: Flash Programmer: Start Erase from = 0x2000 to 0xb7ff
CORTEX_M0P: Flash Programmer: RAM loader returned after 10 ms 
CORTEX_M0P: Flash Programmer: RAM loader returned after 10 ms 
[...]
CORTEX_M0P: Flash Programmer: RAM loader returned after 10 ms 
CORTEX_M0P: Flash Programmer: RAM loader returned after 10 ms 
CORTEX_M0P: Flash Programmer: RAM loader returned after 10 ms 
CORTEX_M0P: Error: (Error -1001 @ 0x0) Requested operation is not supported on this device. (Emulation package 9.12.0.00150) 
CORTEX_M0P: Trouble Halting Target CPU: (Error -2064 @ 0x0) Unable to read device status. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 9.12.0.00150) 
CORTEX_M0P: Error: (Error -614 @ 0x0) The target indicates there is an error condition from a previous SWD  request. Clear the error the condition, and try the SWD request again. (Emulation package 9.12.0.00150) 
CORTEX_M0P: Trouble Halting Target CPU: (Error -2064 @ 0x0) Unable to read device status. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 9.12.0.00150) 
CORTEX_M0P: Error: (Error -614 @ 0x0) The target indicates there is an error condition from a previous SWD  request. Clear the error the condition, and try the SWD request again. (Emulation package 9.12.0.00150) 
[...]
CORTEX_M0P: Trouble Halting Target CPU: (Error -2064 @ 0x0) Unable to read device status. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 9.12.0.00150) 
CORTEX_M0P: Error: (Error -614 @ 0x0) The target indicates there is an error condition from a previous SWD  request. Clear the error the condition, and try the SWD request again. (Emulation package 9.12.0.00150) 
CORTEX_M0P: Trouble Halting Target CPU: (Error -2064 @ 0x0) Unable to read device status. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 9.12.0.00150) 
CORTEX_M0P: Unable to determine target status after 20 attempts
CORTEX_M0P: Failed to remove the debug state from the target before disconnecting.  There may still be breakpoint op-codes embedded in program memory.  It is recommended that you reset the emulator before you connect and reload your program before you continue debugging
CORTEX_M0P: File Loader: Memory write failed: Could not read 0x20200014: target is not connected
CORTEX_M0P: GEL: File: /home/sinotech/crypto_win/Firma/Projects-Embedded/workspace-ccs12/BDC_firmware/MyTest/Firmware_A02/MyTest.out: Load failed.
CORTEX_M0P: Flash Programmer: Hard reset after programming

After that the controller can no longer be accessed. Any attempt to to access the controller fails with error -614. I tried to ...

  • Reset the controller
  • Re-powering the controller
  • Start debugger while controller is under reset
  • Start debugger while controller is not powered and only power it after the debugger mentions no valid supply voltage has been detected

We are using the following configuration:

  • CCS 12.4
  • MSPM0 SDK 1.10.0.5
  • XDS 110 (stand-alone as well as the Launchpad)
  • SWD interface for debugging

Any help is appreciated.

Kind regards,

Thomas

  • Hi Thomas,

    Please first refer to the slide to unlock the device.

    Unlock MSPM0.pptx

    Thanks,

    Yuhao

  • Dear Yuhao,

    thank you for the response and the slide, I successfully performed a mass erase and gained access to the controller again.

    As described in my initial post, when trying to debug the firmware (placed at address 0x2000) the XDS110 seems to temporary override some flash sections (line 7 in the output below) and hence removes the bootloader which is placed at 0x0. Is there a way to prevent it from doing so?

    CORTEX_M0P: GEL Output: Memory Map Initialization Complete
    CORTEX_M0P: Flash Programmer: Verbose output enabled
    CORTEX_M0P: Flash Programmer: DLL Version 1.4.1.0 
    CORTEX_M0P: Flash Programmer: FlashResetBeforeLoadSetting = 1
    CORTEX_M0P: Flash Programmer: FlashResetType = Hard reset
    CORTEX_M0P: Flash Programmer: Hard reset before programming
    CORTEX_M0P: Writing Flash @ Address 0x00000000 of Length 0x00002988
    CORTEX_M0P: Flash Programmer: Uploading RAM loader to device
    CORTEX_M0P: Flash Programmer: RAM loader returned after 10 ms 
    CORTEX_M0P: Flash Programmer: Device init finished
    CORTEX_M0P: Flash Programmer: Erasing main memory by sectors
    CORTEX_M0P: Flash Programmer: Start Erase from = 0x2000 to 0xb7ff
    [...]

    Kind regards,

    Thomas

  • Hi Thomas,

    I will invite our expert to help you.

    Thanks,

    Yuhao

  • To make the bootloader work at start address 0x2000, you need to modify the non-main flash to enable the secondary BSL and input the start address of the secondary BSL. To protect the BSL area you can also use the static flash protection feature that you can configure it in the non-main flash also. More details you can refer to our secondary BSL demo that located in the ...\mspm0_sdk_1_10_00_05\examples\nortos\LP_MSPM0G3507\bsl\secondary_bsl

    By the way, make sure your sysconfig version to be 1.17.0

  • Dear Gary,

    thank you for your response. Our custom bootloader is currently placed at address 0x0 and we would like to stay with that solution as the bootloader is automatically started after a reset and we do not need to make any changes to the non-main flash. The current problem is that the debugger overrides the bootloader when debugging our regular firmware, which is placed at address 0x2000. As debugger is configured to not erase flash sections containing the bootloader (see picture below) and the flash sections are also not part of the regular firmware, we would like to know why the debugger is doing so.

    Relevant configuration of the debugger:

    /cfs-file/__key/communityserver-discussions-components-files/908/pastedimage1692266539001v1.png

    Kind regards,

    Thomas

  • Hi Thomas,

    I have try it on my PC about this function with no issue. Few questions below

    1. your bootloader firmware is not exceed 0x2000 right?

    2. you can try to generate the firmware of the bootloader and application's TI-TXT format image and put it here, let me double confirm if any conflict there. Or if you can put your bootloader and application projects here will be better.

  • Hi Gary,

    I'm not sure how to change the output to TI-TXT, so I used intel HEX instead:

    Bootloader:

    :1000000000802020B5040000B1040000B10400000D
    :1000100000000000000000000000000000000000E0
    :10002000000000000000000000000000B10400001B
    :100030000000000000000000B1040000B104000056
    :10004000B1040000B1040000B1040000B1040000DC
    :10005000B1040000B1040000B1040000B1040000CC
    :1000600000000000B1040000B10400000000000026
    :1000700000000000B1040000B1040000B104000061
    :10008000B1040000B1040000B1040000B10400009C
    :10009000B1040000B10400000000000000000000F6
    :1000A000B1040000B10400000000000000000000E6
    :1000B000B104000000000000B1040000B104000021
    :1000C00010B5064C2378002B07D1054B002B02D02E
    :1000D000044800E000BF0123237010BD6804202005
    :1000E0000000000000070000044B10B5002B03D0F7
    :1000F0000349044800E000BF10BDC04600000000F6
    :100100006C04202000070000164B002B00D1144B7C
    :100110009D46402292029A1A924600218B460F4633
    :100120001348144A121A00F0A5FA0F4B002B00D006
    :1001300098470E4B002B00D0984700200021040068
    :100140000D000D48002802D00C4800E000BF00F070
    :100150006DFA2000290000F0DBF900F051FAC046EA
    :1001600000000800008020200000000000000000C7
    :10017000680420208404202000000000000000000B
    :10018000002243088B4274D303098B425FD3030AD6
    :100190008B4244D3030B8B4228D3030C8B420DD3E9
    :1001A000FF22090212BA030C8B4202D31212090277
    :1001B00065D0030B8B4219D300E0090AC30B8B42B5
    :1001C00001D3CB03C01A5241830B8B4201D38B0363
    :1001D000C01A5241430B8B4201D34B03C01A524108
    :1001E000030B8B4201D30B03C01A5241C30A8B424B
    :1001F00001D3CB02C01A5241830A8B4201D38B0236
    :10020000C01A5241430A8B4201D34B02C01A5241D9
    :10021000030A8B4201D30B02C01A5241CDD2C3094B
    :100220008B4201D3CB01C01A524183098B4201D3C7
    :100230008B01C01A524143098B4201D34B01C01AB2
    :10024000524103098B4201D30B01C01A5241C3082A
    :100250008B4201D3CB00C01A524183088B4201D399
    :100260008B00C01A524143088B4201D34B00C01A85
    :100270005241411A00D20146524110467047FFE7F1
    :1002800001B5002000F006F802BDC0460029F7D0F5
    :1002900076E770477047C04670B50A4B0A4D0B4A67
    :1002A0000B4C0C480C49EA50E250C1500B49CA5063
    :1002B0000B4A043BEA50E250C2501020CA5000F0F2
    :1002C00037F970BD0408000000000A40030000B1C7
    :1002D00000200A4000000340010000B100801040EF
    :1002E00001000026812210B595248820104B114969
    :1002F000640199601A629A63DA63DA65196659666D
    :100300009966D967191DCA670431CA670A4A0B4939
    :10031000105150500A4A0B481051505080200A4941
    :100320008005505082225A65084A9A6510BDC04621
    :10033000008042408100040000000A40D01200000A
    :1003400000200A4044800100901300008200040055
    :10035000C021074A074B08485360036A09061B027D
    :100360001B0A0B430362002393600733136070473B
    :1003700010E000E0FF7C000000ED00E010B5024955
    :10038000024800F02BF910BDEC060000000003400D
    :100390000321094A13688B431360084B0C311A6818
    :1003A0008A431A601A6821318A4300211A60044A7C
    :1003B000044BD1507047C04600010B4004010B4074
    :1003C00000F00A400813000010B50221024A034859
    :1003D00000F0B4F810BDC046B006000000A04240D6
    :1003E00010B50321024A034800F0A8F810BDC0462A
    :1003F000C806000000A0424010B5FFF7E5FFFFF778
    :10040000EFFF10BD70B5194C1949200000F0DCF861
    :100410002000184900F0B4F888225201A358164968
    :100420003F250B40A35011231449605843409BB211
    :100430004340635017231249605843402B404340C8
    :10044000635001210F48235825580B406B400B4047
    :100450006B40235080200C4BC000E05080200B4BA1
    :100460000001E050A3581943A15070BD0080104016
    :10047000E0060000E2060000FF7FFEFF1011000012
    :100480001411000004110000581000008810000032
    :1004900010B5FFF701FFFFF725FFFFF759FFFFF743
    :1004A0006DFFFFF775FFFFF7A7FFFFF7ABFF10BD6D
    :1004B000FEE7000010B50E4A0E4B0F498B420ED3DB
    :1004C0000E4A0F4B0F498B420CD300210E4B0F4AA3
    :1004D00093420AD300F01CF8FFF7EAFF10BD01CAEF
    :1004E00001C3EBE701CA01C3EDE702C3F0E7C04671
    :1004F0000807000000042020680420207007000086
    :1005000088042020880420206804202084042020DF
    :100510000022054B10B59A60FFF7BAFF034B5B68EA
    :100520005A1C00D09847FEE700ED00E000200000D4
    :1005300002380438C046FCD27047C04610B5536834
    :100540009468234314692343546924012343948901
    :100550002343D489240123430C002134FF34240194
    :1005600023501378527889001A43BF234018034957
    :100570004458624013406340435010BD10110000C6
    :10058000882230B5012452018358A34383508D78CB
    :100590000B8884582B438D882B43094D63402B4097
    :1005A00063408350CA798B79064C13430A7A055904
    :1005B00013437E226B4013406B40035130BDC04655
    :1005C00018670200041100000A78034BC2504A78F1
    :1005D000083BC2507047C046081000004A780B78AC
    :1005E00013434A8813438822520183508B684A6818
    :1005F0001B041343014A83507047C0460811000092
    :10060000084B10B50400002B02D0002100E000BF11
    :10061000054B1868836A002B00D09847200000F033
    :1006200031F8C04600000000F806000070B5002652
    :100630000C4D0D4C641BA410A64209D1002600F0FD
    :1006400027F80A4D0A4C641BA410A64205D170BDC0
    :10065000B300EB5898470136EEE7B300EB589847E4
    :100660000136F2E7000000000000000088060000EC
    :100670009006000003008218934200D17047197061
    :100680000133F9E7FEE7C046E90000000000000082
    :10069000F8B5C046F8BC08BC9E4670470000000094
    :1006A000F8B5C046C1000000F8BC08BC9E467047C3
    :1006B0001100000000000020000000000000000009
    :1006C0000000000000000300120000000000000015
    :1006D0000000000000000000000003000000000017
    :1006E00008000000180000000030000001000000B9
    :1006F00000000000000000000804202000000000AE
    :0807000008FAFF7F0100000070
    :100708000000000008042020000000000000000095
    :1007180000000000000000000000000000000000D1
    :1007280000000000000000000000000000000000C1
    :1007380000000000000000000000000000000000B1
    :1007480000000000000000000000000000000000A1
    :100758000000000000000000000000000000000091
    :08076800000000000000000089
    :04000003000000C039
    :00000001FF
    

    Firmware:

    :1020000000802020B9240000B5240000B524000081
    :1020100000000000000000000000000000000000C0
    :10202000000000000000000000000000B5240000D7
    :102030000000000000000000B5240000152500008D
    :10204000B5240000B5240000B5240000B52400002C
    :10205000B5240000B5240000B5240000B52400001C
    :1020600000000000B5240000B524000000000000BE
    :1020700000000000B5240000B5240000B5240000D5
    :10208000B5240000B5240000B5240000B5240000EC
    :10209000B5240000B524000000000000000000008E
    :1020A000B5240000B524000000000000000000007E
    :1020B000B524000000000000B5240000B524000095
    :1020C00010B5064C2378002B07D1054B002B02D00E
    :1020D000044800E000BF0123237010BD3808202011
    :1020E0000000000080290000044B10B5002B03D035
    :1020F0000349044800E000BF10BDC04600000000D6
    :102100003C08202080290000164B002B00D1144BE6
    :102110009D46402292029A1A924600218B460F4613
    :102120001348144A121A00F0A3FA0F4B002B00D0E8
    :1021300098470E4B002B00D0984700200021040048
    :102140000D000D48002802D00C4800F063FB00F0A1
    :102150006DFA2000290000F0E5F900F057FAC046BA
    :1021600000000800008020200000000000000000A7
    :10217000380820207C082020152800002528000091
    :10218000002243088B4274D303098B425FD3030AB6
    :102190008B4244D3030B8B4228D3030C8B420DD3C9
    :1021A000FF22090212BA030C8B4202D31212090257
    :1021B00065D0030B8B4219D300E0090AC30B8B4295
    :1021C00001D3CB03C01A5241830B8B4201D38B0343
    :1021D000C01A5241430B8B4201D34B03C01A5241E8
    :1021E000030B8B4201D30B03C01A5241C30A8B422B
    :1021F00001D3CB02C01A5241830A8B4201D38B0216
    :10220000C01A5241430A8B4201D34B02C01A5241B9
    :10221000030A8B4201D30B02C01A5241CDD2C3092B
    :102220008B4201D3CB01C01A524183098B4201D3A7
    :102230008B01C01A524143098B4201D34B01C01A92
    :10224000524103098B4201D30B01C01A5241C3080A
    :102250008B4201D3CB00C01A524183088B4201D379
    :102260008B00C01A524143088B4201D34B00C01A65
    :102270005241411A00D20146524110467047FFE7D1
    :1022800001B5002000F006F802BDC0460029F7D0D5
    :1022900076E770477047C04670B50A4D0A4B0B4A47
    :1022A000EA500B4CE2500B480B49C1500B49CA5045
    :1022B000043B0B4AEA50E250C250CA50102000F0D2
    :1022C0003DF970BD00000A4004080000030000B1A1
    :1022D00000200A4000000340010000B100801040CF
    :1022E0000100002610B5124B1249996081221A6232
    :1022F0009A63DA63DA65196659669966D967802147
    :102300005A5004315A500C4A9524640188201051C7
    :102310000A4950500A4A0B48105150500A4980202F
    :102320008005505082225A65084A9A6510BDC04601
    :10233000008042408100040000000A40D0120000EA
    :1023400000200A4044800100901300008200040035
    :10235000074A084B53600848036A1B021B0AC02146
    :1023600009060B4303620023936007331360704731
    :1023700010E000E0FF7C000000ED00E010B5024935
    :10238000024800F031F910BD702900000000034040
    :10239000094A136803218B431360084B1A680C31F8
    :1023A0008A431A601A6821318A431A60044A054B2D
    :1023B0000021D1507047C04600010B4004010B4082
    :1023C00000F00A400813000010B5034A0221034838
    :1023D00000F0BAF810BDC0463029000000A042400D
    :1023E00010B5034A0321034800F0AEF810BDC04603
    :1023F0004829000000A0424010B5FFF7E5FFFFF7B5
    :10240000EFFF10BD70B51A4C1A49200000F0E2F839
    :102410001949200000F0BAF888225201A358174940
    :102420000B40A35016496058112343401B041B0C5A
    :102430004340635013482558172169403F230B4000
    :102440006B4023501048235801210B4025586B4006
    :102450000B406B4023500D4B8020C000E0500C4BD4
    :1024600080200001E050A3580B43A35070BDC0462C
    :10247000008010406029000064290000FF7FFEFFFB
    :102480001011000014110000041100005810000089
    :102490008810000010B5FFF7FFFEFFF723FFFFF7DE
    :1024A00057FFFFF76BFFFFF773FFFFF7A5FFFFF77E
    :1024B000A9FF10BDFEE7000010B50E4B0E4A0F49F4
    :1024C0008B4202D202CA02C3F9E70D4B0D4A0E49F4
    :1024D0008B4202D202CA02C3F9E70C4B01E0002290
    :1024E00004C30B4A9342FAD300F01CF8FFF7E2FF53
    :1024F00010BDC04600042020882900003808202094
    :102500007C082020C02D00008008202038082020D2
    :102510007C082020024A1368013313607047C046CC
    :102520005408202010B5034A034B9A60FFF7B2FF0E
    :10253000FEE7C0460020000000ED00E0023804384D
    :10254000C046FCD27047C04610B553689468234318
    :102550001469234354692401234394892343D48970
    :10256000240123430C002134FF3424012350137829
    :10257000527889001A43BF234018034944586240E7
    :1025800013406340435010BD10110000882230B545
    :10259000012452018358A34383508D780B888458BB
    :1025A0002B438D882B43094D63402B406340835060
    :1025B000CA798B79064C13430A7A055913437E2254
    :1025C0006B4013406B40035130BDC046186702009A
    :1025D000041100000A78034BC2504A78083BC250ED
    :1025E0007047C046081000004A780B7813434A88A9
    :1025F00013438822520183508B684A681B0413439B
    :10260000014A83507047C0460811000010B50021F0
    :10261000040000F08DF8044B1868C36B002B00D049
    :102620009847200000F06CF97C29000070B50C4D33
    :102630000C4E761BB61005D0002408CD0134984707
    :10264000A642FAD100F064F9074D084E761BB61089
    :1026500005D0002408CD01349847A642FAD170BDB8
    :102660000000000000000000082900001029000000
    :10267000F0B5050083074AD0541E002A44D0030059
    :102680000322CEB202E00135013C3DD301332E706E
    :102690001342F8D1032C2FD9FF220A40150215430B
    :1026A0002A0415430F2C35D92700103F3F093E015E
    :1026B000B4461E001A0010366644156055609560D9
    :1026C000D5601032B242F8D10F260C2201373F01FB
    :1026D0002640DB193700224217D03E1FB608B4004F
    :1026E000A4461A001C1D644420C2A242FCD103244B
    :1026F0000136B6009B193C40002C05D0C9B21C190C
    :10270000197001339C42FBD1F0BD3400F4E7140092
    :102710000300BFE72700E0E7034B10B5002B02D012
    :10272000024800F077F810BD0000000025280000E6
    :10273000F0B5DE464E4657464546E0B5334B83B0CE
    :102740001B680190180000930F0000F07FF8304BD9
    :102750001B681A000093A4235B00D65801229946F7
    :102760009346002E30D07468651E2DD4C4235B00C0
    :102770009A460134A4003419B24402E0043C013DFD
    :1027800022D3002F04D080235B00E358BB42F5D155
    :1027900073682268013BAB4232D000232360002AD9
    :1027A000ECD07368514698465B46AB4009681942C5
    :1027B00015D19047736843451ED14A46009B9B58EC
    :1027C000B342DBD01E1ECED1104B186800F040F88B
    :1027D00003B03CBC90469946A246AB46F0BD3100E2
    :1027E0008D31FF31096819420CD180230198E158DD
    :1027F000904773684345E0D04A46009B9E58B0E737
    :102800007560CCE78023E0589047D3E7300820205C
    :102810007C29000010B5010000230022002000F0F8
    :1028200019F810BD70B5074D074C641BA41005D0F6
    :10283000013CA300EB589847002CF9D100F070F848
    :1028400070BDC04600000000000000007047C04698
    :102850007047C046F0B5D6464F464646C0B5264FEF
    :1028600082B006003868924698468946FFF7EEFF28
    :10287000224B1B680193A423019A5B00D558002DBD
    :102880002ED06C681F2C30DC002E0FD1631C6B60C7
    :102890004B460234A40038686351FFF7D9FF00208B
    :1028A00002B01CBC90469946A246F0BD8822514613
    :1028B0002800A300EB189950873AA2408930FF30D6
    :1028C0000168114301608421404649005850022E9E
    :1028D000DCD12B008D33FF3319680A431A60D5E72A
    :1028E00015004D35FF35D550CBE73868FFF7B0FF01
    :1028F00001204042D4E7C046300820207C29000057
    :10290000FEE7C04600000000E92000001927000093
    :10291000F8B5C046F8BC08BC9E46704700000000F1
    :10292000F8B5C046C1200000F8BC08BC9E46704700
    :102930001100000000000020000000000000000066
    :102940000000000000000300120000000000000072
    :102950000000000000000000000003000000000074
    :102960000800000000001800000000300000000017
    :10297000010000000000000000000000080420200A
    :0829800088F7FF7F0100000051
    :10298800000000000804202000000000F4062020B9
    :102998005C072020C4072020000000000000000081
    :1029A800000000000000000000000000000000001F
    :1029B800000000000000000000000000000000000F
    :1029C80000000000000000000000000000000000FF
    :1029D80000000000000000000000000000000000EF
    :1029E80000000000000000000000000000000000DF
    :1029F80000000000000000000000000000000000CF
    :102A080000000000000000000000000000000000BE
    :102A180000000000000000000000000000000000AE
    :102A2800000000000000000000000000000000009E
    :102A380001000000000000000E33CDAB34126DE63B
    :102A4800ECDE05000B0000000000000000000000A4
    :102A5800000000000000000000000000000000006E
    :102A6800000000000000000000000000000000005E
    :102A7800000000000000000000000000000000004E
    :102A8800000000000000000000000000000000003E
    :102A9800000000000000000000000000000000002E
    :102AA800000000000000000000000000000000001E
    :102AB800000000000000000000000000000000000E
    :102AC80000000000000000000000000000000000FE
    :102AD80000000000000000000000000000000000EE
    :102AE80000000000000000000000000000000000DE
    :102AF80000000000000000000000000000000000CE
    :102B080000000000000000000000000000000000BD
    :102B180000000000000000000000000000000000AD
    :102B2800000000000000000000000000000000009D
    :102B3800000000000000000000000000000000008D
    :102B4800000000000000000000000000000000007D
    :102B5800000000000000000000000000000000006D
    :102B6800000000000000000000000000000000005D
    :102B7800000000000000000000000000000000004D
    :102B8800000000000000000000000000000000003D
    :102B9800000000000000000000000000000000002D
    :102BA800000000000000000000000000000000001D
    :102BB800000000000000000000000000000000000D
    :102BC80000000000000000000000000000000000FD
    :102BD80000000000000000000000000000000000ED
    :102BE80000000000000000000000000000000000DD
    :102BF80000000000000000000000000000000000CD
    :102C080000000000000000000000000000000000BC
    :102C180000000000000000000000000000000000AC
    :102C2800000000000000000000000000000000009C
    :102C3800000000000000000000000000000000008C
    :102C4800000000000000000000000000000000007C
    :102C5800000000000000000000000000000000006C
    :102C6800000000000000000000000000000000005C
    :102C7800000000000000000000000000000000004C
    :102C8800000000000000000000000000000000003C
    :102C9800000000000000000000000000000000002C
    :102CA800000000000000000000000000000000001C
    :102CB800000000000000000000000000000000000C
    :102CC80000000000000000000000000000000000FC
    :102CD80000000000000000000000000000000000EC
    :102CE80000000000000000000000000000000000DC
    :102CF80000000000000000000000000000000000CC
    :102D080000000000000000000000000000000000BB
    :102D180000000000000000000000000000000000AB
    :102D2800000000000000000000000000000000009B
    :102D3800000000000000000000000000000000008B
    :102D4800000000000000000000000000000000007B
    :102D5800000000000000000000000000000000006B
    :102D6800000000000000000000000000000000005B
    :102D7800000000000000000000000000000000004B
    :102D8800000000000000000000000000000000003B
    :102D9800000000000000000000000000000000002B
    :102DA800000000000000000000000000000000001B
    :082DB800580820200000000073
    :04000003000020C019
    :00000001FF

    Also, is it possible that the debugger uses the wrong start address when downloading the firmware to the controller? The output on line 7 which I was wondering about, seems to be the start address and length of the firmware it is going to program. We are using "GNU v9.2.1 (Linaro)" as compiler, installed through CCS12.3 ("Help" -> "Install GCC ARM Compiler Tools").

    • Compiler: GNU v9.2.1
    • Options:
      • Place each function into its own section (-ffunction-sections)
      • Place data items into their own sections (-fdata-sections)
      • Remove unused sections (--gc-sections)

    CORTEX_M0P: GEL Output: Memory Map Initialization Complete
    CORTEX_M0P: Flash Programmer: Verbose output enabled
    CORTEX_M0P: Flash Programmer: DLL Version 1.4.1.0 
    CORTEX_M0P: Flash Programmer: FlashResetBeforeLoadSetting = 1
    CORTEX_M0P: Flash Programmer: FlashResetType = Hard reset
    CORTEX_M0P: Flash Programmer: Hard reset before programming
    CORTEX_M0P: Writing Flash @ Address 0x00000000 of Length 0x00002988
    CORTEX_M0P: Flash Programmer: Uploading RAM loader to device
    CORTEX_M0P: Flash Programmer: RAM loader returned after 10 ms 
    CORTEX_M0P: Flash Programmer: Device init finished
    CORTEX_M0P: Flash Programmer: Erasing main memory by sectors
    CORTEX_M0P: Flash Programmer: Start Erase from = 0x2000 to 0xb7ff
    CORTEX_M0P: Flash Programmer: RAM loader returned after 10 ms 
    CORTEX_M0P: Flash Programmer: RAM loader returned after 10 ms 
    [...]
    CORTEX_M0P: Flash Programmer: RAM loader returned after 10 ms 
    CORTEX_M0P: Flash Programmer: RAM loader returned after 10 ms 
    CORTEX_M0P: Flash Programmer: RAM loader returned after 10 ms 
    CORTEX_M0P: Error: (Error -1001 @ 0x0) Requested operation is not supported on this device. (Emulation package 9.12.0.00150) 
    CORTEX_M0P: Trouble Halting Target CPU: (Error -2064 @ 0x0) Unable to read device status. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 9.12.0.00150) 
    CORTEX_M0P: Error: (Error -614 @ 0x0) The target indicates there is an error condition from a previous SWD  request. Clear the error the condition, and try the SWD request again. (Emulation package 9.12.0.00150) 
    CORTEX_M0P: Trouble Halting Target CPU: (Error -2064 @ 0x0) Unable to read device status. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 9.12.0.00150) 
    CORTEX_M0P: Error: (Error -614 @ 0x0) The target indicates there is an error condition from a previous SWD  request. Clear the error the condition, and try the SWD request again. (Emulation package 9.12.0.00150) 
    [...]
    CORTEX_M0P: Trouble Halting Target CPU: (Error -2064 @ 0x0) Unable to read device status. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 9.12.0.00150) 
    CORTEX_M0P: Error: (Error -614 @ 0x0) The target indicates there is an error condition from a previous SWD  request. Clear the error the condition, and try the SWD request again. (Emulation package 9.12.0.00150) 
    CORTEX_M0P: Trouble Halting Target CPU: (Error -2064 @ 0x0) Unable to read device status. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 9.12.0.00150) 
    CORTEX_M0P: Unable to determine target status after 20 attempts
    CORTEX_M0P: Failed to remove the debug state from the target before disconnecting.  There may still be breakpoint op-codes embedded in program memory.  It is recommended that you reset the emulator before you connect and reload your program before you continue debugging
    CORTEX_M0P: File Loader: Memory write failed: Could not read 0x20200014: target is not connected
    CORTEX_M0P: GEL: File: /home/sinotech/crypto_win/Firma/Projects-Embedded/workspace-ccs12/BDC_firmware/MyTest/Firmware_A02/MyTest.out: Load failed.
    CORTEX_M0P: Flash Programmer: Hard reset after programming

    Kind regards,

    Thomas

  • Just confirm with you that your optimization level is 0 right?

    We do have see some device lock issue when use GUN and PLL with external crystal under optimization level 0.

    You can try to use optimization level 2 or change to TI-Clang compiler.

  • Hi Gary,

    we have set the optimiziation level to "-Og".

    I will try with "tiarmclang" tomorrow and give feedback.

    Kind regards,

    Thomas

  • Dear Gary,

    I can confirm that the issue does not occur when using ticlang, only GNU/gcc seems to be affected. We do not use an external crystal and even changing optimization to O2 makes no difference.

    Is it possible to make the output more verbose to see what sections the debugger is programming and where it takes addresses from? According to our map file .text and .data sections should be located at the right positions. However, there are some additional sections (e.g. .ARM.attributes, .debug_info, ...) that are located at 0x0. I would expect those sections only contain meta-information and should not have any impact to memory layout that is programmed.

    Kind regards,

    Thomas

  • Hi Thomas,

    Do you have a single CCS project that can reproduce this issue? I want to reproduce the issue on myside to see if it is the same issue we have faced before.

  • Attached a ZIP with three very basic projects:

    1) MyTest_bootloader

    The application currently only reads the start address of the firmware and jumps to it.

    2) MyTest_ticlang (working)

    The firmware that is started by the bootloader compiled with ticlang. The firmware currently only relocates the interrupt vector table (SCB->VTOR) and enters an endless loop.

    3) MyTest_gcc (not working)

    Same as above but compiled with GNU/gcc.

    I really appreciate your help.

    Kind regards,

    Thomas

    MyTest_demo.zip

  • There is a workaround we have verified here that to modify the linker file(.lds file) as below

    This issue will should be fixed in next CCS update

  • Dear Gary,

    unfortunately it did not resolve my issue, the output is still the same:

    CORTEX_M0P: GEL Output: Memory Map Initialization Complete
    CORTEX_M0P: Flash Programmer: Verbose output enabled
    CORTEX_M0P: Flash Programmer: DLL Version 1.4.1.0 
    CORTEX_M0P: Flash Programmer: FlashResetBeforeLoadSetting = 1
    CORTEX_M0P: Flash Programmer: FlashResetType = Hard reset
    CORTEX_M0P: Flash Programmer: Hard reset before programming
    CORTEX_M0P: Writing Flash @ Address 0x00000000 of Length 0x00002e70
    CORTEX_M0P: Flash Programmer: Uploading RAM loader to device
    CORTEX_M0P: Flash Programmer: RAM loader returned after 10 ms 
    CORTEX_M0P: Flash Programmer: Device init finished
    CORTEX_M0P: Flash Programmer: Erasing main memory by sectors
    CORTEX_M0P: Flash Programmer: Start Erase from = 0x2000 to 0xffff
    CORTEX_M0P: Flash Programmer: RAM loader returned after 10 ms 
    CORTEX_M0P: Flash Programmer: RAM loader returned after 10 ms 
    [...]
    CORTEX_M0P: Flash Programmer: RAM loader returned after 10 ms 
    CORTEX_M0P: Flash Programmer: RAM loader returned after 10 ms 
    CORTEX_M0P: Error: (Error -1001 @ 0x0) Requested operation is not supported on this device. (Emulation package 9.12.0.00150) 
    CORTEX_M0P: Trouble Halting Target CPU: (Error -2064 @ 0x0) Unable to read device status. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 9.12.0.00150) 
    CORTEX_M0P: Error: (Error -614 @ 0x0) The target indicates there is an error condition from a previous SWD  request. Clear the error the condition, and try the SWD request again. (Emulation package 9.12.0.00150) 
    CORTEX_M0P: Trouble Halting Target CPU: (Error -2064 @ 0x0) Unable to read device status. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 9.12.0.00150) 
    CORTEX_M0P: Error: (Error -614 @ 0x0) The target indicates there is an error condition from a previous SWD  request. Clear the error the condition, and try the SWD request again. (Emulation package 9.12.0.00150) 
    CORTEX_M0P: Trouble Halting Target CPU: (Error -2064 @ 0x0) Unable to read device status. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 9.12.0.00150) 
    CORTEX_M0P: Error: (Error -614 @ 0x0) The target indicates there is an error condition from a previous SWD  request. Clear the error the condition, and try the SWD request again. (Emulation package 9.12.0.00150) 
    [...]
    CORTEX_M0P: Error: (Error -614 @ 0x0) The target indicates there is an error condition from a previous SWD  request. Clear the error the condition, and try the SWD request again. (Emulation package 9.12.0.00150) 
    CORTEX_M0P: Trouble Halting Target CPU: (Error -2064 @ 0x0) Unable to read device status. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 9.12.0.00150) 
    CORTEX_M0P: Unable to determine target status after 20 attempts
    CORTEX_M0P: Failed to remove the debug state from the target before disconnecting.  There may still be breakpoint op-codes embedded in program memory.  It is recommended that you reset the emulator before you connect and reload your program before you continue debugging
    CORTEX_M0P: File Loader: Memory write failed: Could not read 0x20200014: target is not connected
    CORTEX_M0P: GEL: File: /home/sinotech/crypto_win/Firma/Projects-Embedded/workspace-ccs12/MyTest_gcc/Debug/MyTest_gcc.out: Load failed.
    CORTEX_M0P: Flash Programmer: Hard reset after programming
    

    Did you try it with the sample projects I provided above? Did you make any changes to the settings?

    Kind regards,

    Thomas

  • Not test you code yet. But I try to do it now. How do I test test your code? 

    I saw that you have modified the project "MyTest_gcc" and "MyTest_ticlang" linker file that move it to address 0x2000, you can't download the code directly into the device. 

    2) MyTest_ticlang (working)

    Can you give more detail steps to do the test? And how to confirm it is work?

  • You need to first build and download the project "MyTest_bootloader". This project acts as the bootloader which is started after a reset and which, in this very simple case, just jumps to the firmware.

    The projects "MyTest_gcc" and "MyTest_ticlang" act as the firmware which is started through the bootloader. They are both the same, except that one is compiled with GNU/gcc and the other with ticlang.

    So to reproduce the issue you can ...

    1. Build and upload MyTest_bootloader
    2. Build and try debugging MyTest_ticlang (should work)
      1. The debugger programs the firmware, sets a breakpoint in the main()-method and performs a reset
      2. The reset causes the bootloader to start which in turn jumps to the firmware
      3. The firmware starts running and the debugger gains control
    3. Build and try debugging MyTest_gcc (should fail with the errors posted above)
      1. The debugger programs the firmware, thereby overriding data from the bootloader, and performs a reset
      2. As the bootloader has been overriden, the debugger outputs the error messages shown above.

    Kind regards,

    Thomas

  • It seem some errors there. To debug the application project, I usually to put it start at 0x00 first. When finished it and move it to other address. Or if it can work with TI-Clang you also try it. Does it ok for you?

  • Dear Gary,

    we moved the firmware to address 0x0 during development. However, as bootloader and firmware do some data exchange, sometimes it becomes necessary to have them both placed at their final positions during debugging. We temporary moved to ticlang but would appreciate if the errors could be fixed so we can continue using GNU/gcc which we also use in other projects.

    Kind regards,

    Thomas

  • Got it, If you need running the bootloader and application code at the same time it seems you need to separate the RAM area into two area and add a RTOS to do that. More information you can refer to this document https://www.ti.com/lit/an/slaaec9/slaaec9.pdf 

  • Dear Gary,

    Bootloader and firmware are not running at the same time, they are running one after another. They share some RAM memory which they can use to pass additional information. For example the bootloader might use this memory to pass additional parameters to the firmware, ...

    As described above, everything works well when using ticlang as compiler. The issue only occurs when using GNU/gcc, as in that case the debugger seems to override flash memory at address 0x0 when it should not.

    Kind regards,

    Thomas

  • Regarding the error with the GCC program:

    CORTEX_M0P: Error: (Error -1001 @ 0x0) Requested operation is not supported on this device. (Emulation package 9.12.0.00150) 

    I'm not sure what exactly happened but it put the device in a bad state.

    A quick search on E2E indicates that error seems to have come up often for the device:

    https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1252665/mspm0g3507-trouble-halting-target-cpu-during-debugging-project/4740787

    https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1246527/mspm0l1304-jtag-communication-after-downloading

    https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1225714/mspm0g3507-debugger-doesn-t-work-without-power-cycling-the-board/4704064

    Gary - there is one internal thread which mentions a bug in the device support package. I'll send a reference via private comment.

    Thanks

    ki