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.

Need oad.xcl for Timac CC2530

Other Parts Discussed in Thread: TIMAC, CC2530, Z-STACK

I'm trying to modify the Zstack's oad.xcl, to use it on Timac for a CC2530.

Does anybody know how to make this changes?

thank you

  • I would recommend making a copy of the MAC linker file that you are using and modify the copy to be your MAC-OAD linker file (less possible gotchas than trying to convert a Z-Stack linker file into a MAC linker file.) Do a file diff between f8w2530.xcl and oad.xcl and implement the same *changes* in your MAC-OAD linker file. For example

    -D_CODE_START=0x0800

    Changing code start allows the OAD boot code to accept the ISR vectors, as it must. How big is your MAC OAD boot code, the same, only one page?


    -Z(CODE)CHECKSUM=0x0888-0x0889
    -Z(CODE)CRC_SHDW=0x088A-0x088B
    -Z(CODE)PREAMBLE=0x088C-0x0897

    This reserves known locations (where the OAD boot code knows to look) for checksums and image information block.

    // Uncomment when implementing OAD NV by dividing internal flash in half.
    //-P(CODE)BANKED_CODE=_CODE_START-_CODE_END,0x18000-0x1FFFF,0x28000-0x2FFFF,0x38000-0x3E7FF
    // Uncomment when implementing OAD NV by external E2PROM AND external flash is 256 KB or bigger.
    // (e.g. when using SmartRF05 Rev. 1.7 or later.)
    -P(CODE)BANKED_CODE=_CODE_START-_CODE_END,0x18000-0x1FFFF,0x28000-0x2FFFF,0x38000-0x3FFFF,\
    0x48000-0x4FFFF,0x58000-0x5FFFF,0x68000-0x6FFFF,0x78000-0x7C7FF

    I can't image that you will want or need an external NV chip to store the OAD image since the CC2530 has such a big internal flash compared to MAC application code size, so you can simplify and only support internal storage.

    ////////////////////////////////////////////////////////////////////////////////
    //
    //
    // Skip boot code, CRC/shadow & NV pages when calculating the CRC.
    //
    // Uncomment when implementing OAD NV by dividing internal flash in half.
    //-J2,crc16,=800-887,88C-3E7FF
    // Uncomment when implementing OAD NV by external E2PROM AND external flash is 256 KB or bigger.
    // (e.g. when using SmartRF05 Rev. 1.7 or later.)
    -J2,crc16,=800-887,88C-7C7FF
    //
    // Fill code gaps with 0xFFFF so that the CRC can be verified programatically.
    -HFFFF

     

    Code fill with a known value and make IAR calculate your image checksum - perhaps you will make a PC tool that does image processing and preparation for OAD?

     

  • Hello Dirty Harry, I think that MAC-OAD linker file it's ok.

    Now I'm programming the Boot OAD- Boot loader part with orignal linker file oad-boot.xcl.

    For now , all I want to do is copy to flash, the application sored previously in external eeprom. So I read EEprom and copy to Flash.

    All it's ok from 0x0800 until 0x7FFF. But, I have a problem when the process have to write the 0x8000 position and above. Only erase, I can't write. The code I want to write isn't higher than 0xFFFF.

    I see that there is 2  alternative schemes for code memory space.

    How I have to change registers MEMCTR or FCTL in order I can write from 0x8000 until 0xFFFF with  Boot- OAD Boot Loader Project?

    This is my simple code, without CRC:

    #pragma location="NEAR_CODE"

    void main(void)

    {

      HAL_BOARD_INIT();

    #if HAL_OAD_XNV_IS_SPI

    #endif

      /* This is in place of calling HalDmaInit() which would require init of the other 4 DMA

       * descriptors in addition to just Channel 0.

       */

      HAL_DMA_SET_ADDR_DESC0( &dmaCh0 );

      HalFlashInit();

      HalSPI_Init();

      HalEEpromInit();


      for(mult=0x01; mult<0x20; mult++)

        {

          HalFlashErase(mult);

          HalReadEEprom (bytes_read, (mult*0x800), 1024);

          HalFlashWrite((0x800*mult)>>2, bytes_read, 256);


          HalReadEEprom (bytes_read, (mult*0x800)+0x400, 1024);

          HalFlashWrite(((0x800*mult)+0x400)>>2, bytes_read, 256);

        }

        asm("LJMP 0x800\n");
    }

     

  • Now it's working ok.

    Thank you Dirty Harry.