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.

CC2530: Bootloader: Impossible to jump to ISR while running UserCode.

Part Number: CC2530
Other Parts Discussed in Thread: Z-STACK

Hi guys,

I'm doing a project needed to update firmware OTA.

I've already had bootloader program and user program which starts at 0x1000 address.

Everything seems to be fine, except the user code can not jump to ISR.

In the main() of User code, the program can print a string every 500ms (using delay function), but it's impossible to blink led using timer.

I'm pretty sure that the code of user program used to blink led by timer is correct because the user program runs correctly when I change INTVEC to 0x0000.

These are things I've changed in linker file to make a user program:

  1. Change INTVEC from 0x0000 to 0x1000
  2. Change NEARCODE's start address: _CODE0_START=0x1000 (default value is 0x0000).

If anyone has met the same problem, please help me to fix it.

The below lines are 10 first lines in user program's hex file:

:020000040000FA
:0310000002104E8D
:10104B00021CE975D0007581BF751000751107532F // 0x004B is the default timer1 interrupt vector's address
:10105B0092FE02106500000080FBE490070078050B
:10106B0079018002F0A3D8FCD9FA7A047B0790109F
:10107B00A1789A79018015E493A3AD82AE838A821D
:10108B008B83F0A3AA82AB838D828E83D8E9D9E7B9
:10109B00121E091210600D0A5379737469636B2069
:1010AB00316D73000D0A5744543D2575000D0A55DB
:1010BB0073657220436F6465204353523D25303274

  • I use Z-Stack boot loader/OTA on CC2530 and don't see similar issue. Do you run Z-Stack on CC2530?
  • No I haven't added stack to my application, I just made an simple application to test the Booloader Code and User Code.
  • Cannot help since you don’t use Z-Stack.
  • Hello Xuan.

    I think I know what is wrong with your bootloader.

    You need to have in mind that CC2530 does not have a feature to change internally the interruption verctor address.

    Now that you modified your linker to offset the user code start at address 0x1000, all the user code interrupts will have the same offset.

    The T1_VECTOR has the default address at 0x4B. With your offset the T1_VECTOR will be at address 0x104B. This is ok.

    The problem is: When a TIMER1 interrupt occurs, the Program Counter will point to 0x4B and not 0x104B. 

    Changing the values in the linker will not change the processor behavior.

    It will always jump the original INTVECT address.

    If your bootloader doesn't use any interrupt, you can simply write a code in assembly at the address 0x4B that will perform a jump to the location you want (0x104B).

    If your bootloader does use interrupts, you will need to use a more complex approach.

  • Hi Alessandro,

    I make two projects: Bootloader (running without ISR) and User Code (running with ISR).

    I've change the default Bootloader's startup code. Simply copy from the TI's Sample project, add to my BL project and change the INTVEC's offset to 0x1000.

    Thanks for replying.