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.

Debug serial bootloader

Other Parts Discussed in Thread: Z-STACK, CC2530EM

Hello,

 

I would like to do some debugging on the serial bootloader, but it is not possible for me.

 

After flashing with IAR I get the following messages:

First:

"One or more breakpoint could not be set and have been disabled."

Then:

"The stack plug-in failed to set a breakpoint to "main". The Stack window will not be able to display stack contents"

Then:

"There was 1 errors during the initialization of the debugging session. There is more information in the Debug Log window."

And finally in the debug log window:

"Error (col 1): Unknown or ambiguous symbol. main"

 

How can I debug this code. What is missing?

I'm using IAR 8.10 and z-Stack 2.5.0.

 

Thanks,

Felix

 

PS: Is there some documentation on the commands implemented and how to implement a flash tool on the master side (master isn't a windows pc).

  • The linker output format is intel-extended - it is outputting a .hex file, which is not debuggable. You will have to change the linker output format.

    The operation of the boot loader is just as  another MT or RPC client - the documentation is sb_exec.h, mt.h, and mt_rpc.h

    The boot loader sub-system is 0x0D, it acts on SREQ or AREQ, so 0x2D or 0x4D

    The boot loader takes 64-byte chunks of a mono-lithic binary. The chunks are identified by offset into the binary, but the offset is calculated as this:

    Actual Physical Offset / HAL_FLASH_WORD_SIZE

    So the first chunk, bytes 0-63, is offset 0/4=0, the second chunk of bytes 64-127 is offset 64/4=16, and so forth.

    You must send the chunks in order, because the boot loader erases a page based on getting the first chunk of that page. So if the boot loader receives the second chunk before the first, the page will not have been erased and the write will almost surely fail.

    So to packets to write the first two chunks should be this (I am choosing AREQ vice SREQ since this is what you will see if you make a comm port sniffer to watch the windows PC serial boot loader at work):

    FE 40 4D 01 00 00 Actual data bytes 0-63 of the mono-lithic binary image... FCS - calculated over all bytes, not including the SOP of FE.

    FE 40 4D 01 10 00 Actual data bytes 64-127.... FCS

     

    I would recommend not really killing yourself debugging the boot loader - it just works. Rather, run the boot loader on the CC2530EM mounted on the SmartRF05EB so you can use the RS-232 serial port connected to a PC. Run the SBDemo.exe tool and sniff the download to see what to do as the embedded host send bytes.

     

  • Dirty Harry said:

    The linker output format is intel-extended - it is outputting a .hex file, which is not debuggable. You will have to change the linker output format.

     

    Thank you for your answer!

    I will verify it as soon as I'm back in office.

     

    Thanks

    Felix