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 bootload project trim

Other Parts Discussed in Thread: CC2530, Z-STACK

Team

After build the project "Z-Stack Home 1.2.2a.44539\Projects\zstack\Utilities\BootLoad\CC2530" the size of Bin file is about 220KB. It is too large. Is there any method to trim this project to reduce the size?

Thank you

Victor

  • The size of bin file should not be 220KB. The followings are the boot loader size information from my build image.

    2 789 bytes of CODE memory (+ 5 403 range fill )
    22 bytes of DATA memory (+ 30 absolute )
    1 447 bytes of XDATA memory
    192 bytes of IDATA memory
    8 bits of BIT memory
  • 2 789 bytes of CODE memory (+ 5 403 range fill )
    Modify the file cc2530-sb.xcl
    // Fill code gaps with 0xffff so that the CRC can be verified programatically
    -HFFFF

    // Fill code gaps with 0xffff so that the CRC can be verified programatically
    //-HFFFF
    2 789 bytes of CODE memory

    But the APP Do not run
  • Which boot loader project do you use? I don't see project "Z-Stack Home 1.2.2a.44539\Projects\zstack\Utilities\BootLoad\CC2530" uses cc2530-sb.xcl
  • BOOT: Z-Stack Home 1.2.2a.44539\Projects\zstack\Utilities\BootLoad\CC2530 use the file sb-boot.xcl
    APP: Z-Stack Home 1.2.2a.44539\Projects\zstack\HomeAutomation\SampleLight\CC2530DB use the file cc2530-sb.xcl
  • Can you elaborate your question?
  • I use two projects:
    1)Z-Stack Home 1.2.2a.44539\Projects\zstack\Utilities\BootLoad\CC2530
    Options --> Linker --> Linker configuration file
    check the checkbox to "override default" ,and use the file "sb-boot.xcl"

    2)Z-Stack Home 1.2.2a.44539\Projects\zstack\HomeAutomation\SampleLight\CC2530DB
    Options --> Linker --> Linker configuration file, check the checkbox to "override default" ,
    use the following line for "override default"
    "$PROJ_DIR$\..\..\..\Tools\CC2530DB\cc2530-sb.xcl"

    The project SampleLight, In the file cc2530-sb.xcl, have two lines:
    ////////////////////////////////////////////////////////////////////////////////
    //
    // Skip boot code, CRC/shadow & NV pages when calculating the CRC.
    //
    -J2,crc16,=2000-208F,2094-7C7FF
    //
    // Fill code gaps with 0xFFFF so that the CRC can be verified programatically.
    -HFFFF
    //
    ////////////////////////////////////////////////////////////////////////////////

    158 958 bytes of CODE memory (+ 92 946 range fill )
    32 bytes of DATA memory (+ 71 absolute )
    7 811 bytes of XDATA memory
    192 bytes of IDATA memory
    8 bits of BIT memory
    408 bytes of CONST memory

    The size of bin file should be 220KB, It's too large. (92 946 range fill) unnecessary, so I don't use the CRC, and commented code like this:

    ////////////////////////////////////////////////////////////////////////////////
    //
    // Skip boot code, CRC/shadow & NV pages when calculating the CRC.
    //
    //-J2,crc16,=2000-208F,2094-7C7FF
    //
    // Fill code gaps with 0xFFFF so that the CRC can be verified programatically.
    //-HFFFF
    //
    ////////////////////////////////////////////////////////////////////////////////
    AND
    Options --> C/C++ compiler--> Preprocessor -->Defined symbols
    xMAKE_CRC_SHDW

    158 958 bytes of CODE memory
    32 bytes of DATA memory (+ 71 absolute )
    7 811 bytes of XDATA memory
    192 bytes of IDATA memory
    8 bits of BIT memory
    408 bytes of CONST memory

    The size of bin file should be 150KB,It's what I want.

    3)The project BootLoad start the application without checking CRC, I am sure that application is good, and it has been downloaded to the flash.
    But when running "asm("LJMP 0x2000\n")"the system reset.

    4)
    (1)The 220KB file,the system normal running.
    (2)Manually delete the bin file finally 0xFFFF(92 946 range fill ),the system normal running.
    (3)The 150KB file,the system not running.
  • I am confused by your descriptions. In boot loader project hal_ota.c, it would jump to ox800 after boot and you can see the following lines in linker script ota.xcl which means to place OTA image started from 0x800.

    -D_CODE_START=0x0800

    If you intend to jump to 0x2000, you should revise "-D_CODE_START=0x0800" to "-D_CODE_START=0x2000" in ota.xcl.
  • yes, I revise "-D_CODE_START=0x0800" to "-D_CODE_START=0x2000" in ota.xcl.

    According to the above configuration program compiles the three times, respectively to generate different bin file:

    (1)The 220KB file, -----the system normal running.

    (2)Manually delete the bin file finally 0xFFFF(92 946 range fill ), -----the system normal running.

    (3)The 150KB file, -----the system not running, Like a reset.

    If there is no change "-D_CODE_START=0x2000", (1)(2) can't normal running.

    My question is the same configuration,only the CRC commented, why different results(3).

    thanks
  • You shouldn't disable MAKE_CRC_SHDW. CRC is mandatory for boot loader to check if the OTA image is correct.
  • I understand what you mean, I have modified the code in the BootLoad , As described below:
    3)The project BootLoad start the application without checking CRC, I am sure that application is good, and it has been downloaded to the flash.
    uint8 sbImgValid(void)
    {
    return TRUE
    }

    Three of the following:
    (1)The 220KB file, -----the system normal running.
    (2)Manually delete the bin file finally 0xFFFF(92 946 range fill ), -----the system normal running.
    (3)The 150KB file, -----the system not running. NOT RUN.

    (1) (2) in the boot startup APP without CRC check, can be run.

    My goal is to bin file is too large, so delete the useless 0xFFFF
  • If you change linker script to run the 150KB file without boot loader, does it run correctly?
  • yes,  it run correctly . At this moment  .xcl file "-D_CODE_START=0x0000",

  • Since you change "-D_CODE_START=0x0800" to "-D_CODE_START=0x2000" in ota.xcl, do you also change the following lines in hal_ota.h?

    #define HAL_OTA_RC_START 0x0800
    #define HAL_OTA_CRC_ADDR 0x0888
  • Sorry, I don't hal_ota.h, I use two projects:
    BOOT: Z-Stack Home 1.2.2a.44539\Projects\zstack\Utilities\BootLoad\CC2530
    APP: Z-Stack Home 1.2.2a.44539\Projects\zstack\HomeAutomation\SampleLight\CC2530DB

    The linker files:
    sb-boot.xcl
    cc2530-sb.xcl
  • Since you use Z-Stack Home 1.2.2a.44539\Projects\zstack\Utilities\BootLoad\CC2530, it would use the following two lines

    #define HAL_SB_IMG_ADDR 0x2000
    #define HAL_SB_CRC_ADDR 0x2090

    But, I run out of idea to help you.