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.

Issue with #pragma CODE_SECTION and running code from RAM.

Other Parts Discussed in Thread: TMS320F28335

I am working on familiarizing myself with the flash api for TMS320F28335 and have issues with code allocated to run from ram with the CODE_SECTION pragma causing unexpected interrupts to occur and the system to terminate (as Hwi_unPluggedInterrupt) being called by BIOS6. I have functions outlined as such:

#pragma CODE_SECTION(flashSetup, "FAST_CODE")
int flashSetup(void){...}

#pragma CODE_SECTION(testEraseFlashSector, "FAST_CODE")
void testEraseFlashSector(Uint16 sectorMask, char sectorLetter){..}

#pragma CODE_SECTION(flash_unit_test, "FAST_CODE");
int flash_unit_test(void){...}

Which are copied from flash to ram in my main function before anything is called via:

extern Uint16 FAST_CODE_LOADSTART;
extern Uint16 FAST_CODE_RUNSTART;
extern Uint16 FAST_CODE_LOADSIZE;
memcpy(&FAST_CODE_RUNSTART, &FAST_CODE_LOADSTART, FAST_CODE_LOADSIZE);

With the code section FAST_CODE defined in the CMD file as such:

SECTIONS
{

    FAST_CODE:
                          /*
                           * Store the code in flash.
                           */
                          LOAD = TFI,    PAGE = 0

                          /*
                           * Allocate space for all data/code assigned to this section in
                           * L03 ram or M01 ram. We will have to copy from flash to this
                           * memory range in code.
                           */
                          RUN  = L03SARAM, PAGE = 0

                          /*
                           * create a variable FAST_CODE_LOADSTART which sits
                           * at the start of the FAST_CODE section in flash
                           */
                          LOAD_START(_FAST_CODE_LOADSTART),

                          /*
                           * create a var FAST_CODE_LOADSIZE which is the size
                           * of the FAST_CODE section in flash
                           */
                          LOAD_SIZE(_FAST_CODE_LOADSIZE),

                          /*
                           * create a var FAST_CODE_RUNSTART which sits
                           * at the allocated location in ram for the FAST_CODE code.
                           */
                          RUN_START(_FAST_CODE_RUNSTART)

}

And TFI defined as:

MEMORY
{
PAGE 0:                                                                     /* Program and Data Memory */
    TFI         : origin = 0x338000, length = 0x7F80       /* first sector on-chip FLASH */

}

 

Any idea what I might be doing wrong? I have attached a zip of my project:

0523.flash.zip.