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.

OMAP-L138: Booting bare metal DSP code from ARM

Other Parts Discussed in Thread: OMAP-L138, SYSCONFIG

 

Hi TI Support,

We are trying to boot DSP code from the ARM.  We have played with the LED sample on the TI wiki.  We have code to compile the DSP code into a C byte array, and load it to the correct portion of SRAM (0x80010000).  We then set the DSP start address in SYSCONFIG->HOST1CFG and then reset the DSP by setting LRST  bit in PSC0->MDCTL[15] low and then high.  The DSP LED app works properly when loaded from CCSv3, but when loaded by the ARM, it doesn’t seem to start.  Could you provide more details on how exactly to tell the DSP to reset and start executing code at a particular address?

int main() {
    uint32_t  bootAddr = dsp_init();
    EVMOMAPL138_dspDisable();
    EVMOMAPL138_dspBootAddr(bootAddr);
    EVMOMAPL138_dspEnable();

    while(1) {}
} 

void EVMOMAPL138_dspBootAddr(uint32_t addr)
{
   // unlock the system config registers.
   SYSCONFIG->KICKR[0] = KICK0R_UNLOCK;
   SYSCONFIG->KICKR[1] = KICK1R_UNLOCK; 

   // Set DSP boot address vector to entry point of DSP program
   // This must be aligned to 1KB boundaries

   SYSCONFIG->HOST1CFG = addr;  

   // unlock the system config registers.
   SYSCONFIG->KICKR[0] = KICK0R_LOCK;
   SYSCONFIG->KICKR[1] = KICK1R_LOCK;
}

 

void EVMOMAPL138_dspEnable(void)
{
   // power dsp clocks and release core from local reset
   EVMOMAPL138_lpscTransition(PSC0, DOMAIN1, LPSC_DSP, PSC_ENABLE); // clk on
   SETBIT(PSC0->MDCTL[LPSC_DSP], LRST);                             // release reset
}

 

void EVMOMAPL138_dspDisable(void)
{
   // halt dsp core using local reset, then shut down dsp clocks
   CLRBIT(PSC0->MDCTL[LPSC_DSP], LRST);                               // hold reset
   EVMOMAPL138_lpscTransition(PSC0, DOMAIN1, LPSC_DSP, PSC_DISABLE);  // clk off
}

 

Thanks,

Martin

 

P.S. Here is the DSP coff binary converted to a C struct for reference (OMAPL138-DSP-LED/DSP sample compiled into coff out with CCSv3, then dumped with hex6x, and finally reformatted into C struct with perl):

/** === WARNING: AUTO-GENERATED by hex2c.pl === DO NOT MODIFY ===

 *================================================================

 *  libdsp_c6748.hex.c

 *

 *  DSP binary converted into a C byte array structure.

 *  Generated from the following tools:

 *      cl6x  - generated coff from c

 *      hex6x - generates ascii hex from coff

 *      hex2c - generates this c file from hex

 * 

 *================================================================

 */

 

#include <stdint.h>

#include <string.h> 


const uint32_t dsp_start_addr = 0x80010000;


// Load to 0x80010000

const uint8_t dsp_80010000 [] = {

    0x2A,0x3E,0x84,0x07,0xEA,0x00,0xC0,0x07, // 0x80010000

    0xA2,0x07,0xBF,0x07,0x2A,0x14,0x08,0x07, // 0x80010008

    0xEA,0x00,0x40,0x07,0xFA,0x00,0x00,0x02, // 0x80010010

    0xA2,0x03,0x10,0x09,0xA2,0x03,0x10,0x0A, // 0x80010018

    0x2A,0x70,0x06,0x02,0xEA,0x00,0x40,0x02, // 0x80010020

    0x62,0x03,0x10,0x00,0x2A,0x20,0x80,0x01, // 0x80010028

    0x28,0xD0,0x07,0x02,0xEA,0x00,0xC0,0x01, // 0x80010030

    0xE8,0x00,0x40,0x02,0x00,0x00,0x00,0x00, // 0x80010038

    0x28,0x90,0x87,0x01,0xE8,0x00,0xC0,0x01, // 0x80010040

    0x62,0x13,0x0C,0x00,0x2A,0x2C,0x80,0x01, // 0x80010048

    0xEA,0x00,0xC0,0x01,0x00,0x40,0x00,0x00, // 0x80010050

    0x2A,0x00,0x07,0x02,0xEA,0x00,0x40,0x02, // 0x80010058

    0x62,0x03,0x10,0x00,0x2A,0x3A,0x80,0x01, // 0x80010060

    0xEA,0x00,0xC0,0x01,0xA8,0x00,0x00,0x02, // 0x80010068

    0x00,0x20,0x00,0x00,0x90,0x02,0x00,0x00, // 0x80010070

    0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00, // 0x80010078

};


// Load to 0x80010880

const uint8_t dsp_80010880 [] = {

    0xF7,0x31,0x6E,0x2C,0xDB,0x00,0x5B,0x0B, // 0x80010880

    0x20,0xA1,0x04,0x00,0x29,0x1C,0xA0,0x01, // 0x80010888

    0xAA,0x89,0x05,0x02,0xE9,0xE0,0x80,0x01, // 0x80010890

    0xEA,0xF3,0x41,0x02,0x00,0x80,0x60,0xE0, // 0x80010898

    0x76,0x02,0x0C,0x02,0x6E,0x2C,0xC0,0x85, // 0x800108a0

    0x28,0xF0,0xF8,0x01,0x68,0xD2,0xCA,0x01, // 0x800108a8

    0x34,0x00,0x6E,0x2C,0x6E,0x01,0x00,0x02, // 0x800108b0

    0x2A,0x00,0x91,0x02,0x08,0x00,0x40,0xE2, // 0x800108b8

    0x00,0x40,0x00,0x00,0x52,0x98,0x00,0x02, // 0x800108c0

    0x55,0x10,0x6E,0x2C,0x6C,0x00,0x80,0x01, // 0x800108c8

    0x28,0x40,0x03,0x02,0x00,0x40,0x00,0x00, // 0x800108d0

    0x74,0x22,0x0D,0x02,0x00,0x00,0x80,0xE0, // 0x800108d8

    0x00,0x20,0x00,0x00,0x6C,0x00,0x80,0x01, // 0x800108e0

    0x12,0x12,0x6E,0x4C,0x74,0x62,0x0C,0x02, // 0x800108e8

    0x00,0x20,0x00,0x00,0x6C,0x00,0x80,0x01, // 0x800108f0

    0x00,0x60,0x00,0x00,0x00,0x00,0x80,0xE0, // 0x800108f8

    0x74,0x82,0x0C,0x02,0x00,0x20,0x00,0x00, // 0x80010900

    0x6C,0x00,0x80,0x01,0x26,0x46,0x6E,0x4C, // 0x80010908

    0x74,0x82,0x0D,0x02,0x00,0x20,0x00,0x00, // 0x80010910

    0x6E,0x00,0x00,0x02,0x00,0x00,0x00,0xE1, // 0x80010918

    0x6E,0x00,0x80,0x02,0x6E,0x4C,0x4D,0x38, // 0x80010920

    0x6E,0x6C,0x43,0xA2,0x23,0xA2,0xC5,0x38, // 0x80010928

    0x6E,0x2C,0xEF,0xA1,0xF7,0x31,0x6E,0x0C, // 0x80010930

    0x32,0x22,0x27,0x46,0x00,0x20,0xC0,0xEF, // 0x80010938

    0x5B,0x0B,0x72,0xFB,0x27,0x06,0x45,0xBC, // 0x80010940

    0x6E,0x2C,0xA7,0x06,0xEA,0x02,0x80,0x02, // 0x80010948

    0xFA,0x8A,0x14,0x00,0x20,0xA1,0x14,0x30, // 0x80010950

    0x41,0x26,0x45,0xBC,0x01,0x80,0xE0,0xE8, // 0x80010958

    0x6E,0x2C,0x89,0x8E,0x20,0xA1,0xFC,0x2F, // 0x80010960

    0x32,0x22,0x5B,0x09,0x27,0xC6,0x72,0xFB, // 0x80010968

    0x27,0x06,0x45,0xBC,0x6E,0x2C,0xA7,0x06, // 0x80010970

    0xEA,0x02,0x80,0x02,0x60,0x80,0xA0,0xE7, // 0x80010978

    0xFA,0x8A,0x14,0x00,0x20,0xA1,0x0A,0x30, // 0x80010980

    0x41,0x26,0x45,0xBC,0x6E,0x2C,0x89,0x8E, // 0x80010988

    0x20,0xA1,0x04,0x20,0x32,0x22,0x5B,0x07, // 0x80010990

    0x27,0x46,0x32,0xFF,0x00,0x98,0x80,0xED, // 0x80010998

    0x27,0x06,0x45,0xBC,0x6E,0x2C,0xA7,0x06, // 0x800109a0

    0xEA,0x02,0x80,0x02,0xFA,0x8A,0x14,0x00, // 0x800109a8

    0x20,0xA1,0x12,0x30,0x41,0x26,0x45,0xBC, // 0x800109b0

    0x6E,0x2C,0x89,0x8E,0x00,0x00,0x60,0xEC, // 0x800109b8

    0x20,0xA1,0xFA,0x2F,0x32,0x22,0x5B,0x03, // 0x800109c0

    0x27,0xC6,0x32,0xFF,0x27,0x06,0x45,0xBC, // 0x800109c8

    0x6E,0x2C,0xA7,0x06,0xEA,0x02,0x80,0x02, // 0x800109d0

    0xFA,0x8A,0x14,0x00,0x18,0x80,0xC0,0xE3, // 0x800109d8

    0x20,0xA1,0xAC,0x3F,0x41,0x26,0x45,0xBC, // 0x800109e0

    0x6E,0x2C,0x89,0x8E,0x20,0xA1,0x02,0x20, // 0x800109e8

    0x20,0xA1,0xAC,0x0F,0xF7,0x8C,0x65,0xEC, // 0x800109f0

    0x45,0xDC,0x45,0xAC,0x00,0x00,0xC0,0xEC, // 0x800109f8

    0x00,0x20,0x00,0x00,0x6C,0x00,0x80,0x01, // 0x80010a00

    0x47,0x92,0x6E,0x4C,0x76,0xE2,0x0C,0x02, // 0x80010a08

    0x00,0x20,0x00,0x00,0x6C,0x00,0x80,0x01, // 0x80010a10

    0x26,0x46,0x6E,0x4C,0x00,0x00,0x80,0xE8, // 0x80010a18

    0x74,0xA2,0x0C,0x02,0x00,0x20,0x00,0x00, // 0x80010a20

    0x6C,0x00,0x80,0x01,0x4D,0xDC,0x6E,0x6C, // 0x80010a28

    0x76,0x02,0x0D,0x02,0x00,0x20,0x00,0x00, // 0x80010a30

    0x6C,0x00,0x80,0x01,0x00,0x00,0x00,0xE1, // 0x80010a38

    0x00,0x60,0x00,0x00,0x64,0x22,0x0D,0x02, // 0x80010a40

    0x88,0xAD,0x11,0x02,0x74,0x22,0x0D,0x02, // 0x80010a48

    0x00,0x20,0x00,0x00,0x6E,0x00,0x00,0x02, // 0x80010a50

    0xE6,0x42,0x10,0x02,0x00,0x00,0x10,0xE0, // 0x80010a58

    0x0A,0x7F,0x13,0x02,0x5A,0x2A,0x10,0x00, // 0x80010a60

    0x20,0xA1,0x12,0x20,0x6E,0x00,0x00,0x02, // 0x80010a68

    0xE6,0x42,0x10,0x02,0x0A,0x7F,0x13,0x02, // 0x80010a70

    0x5A,0x2A,0x10,0x00,0x00,0x00,0x10,0xE0, // 0x80010a78

    0x20,0xA1,0xFB,0x3F,0xE6,0x62,0x3C,0x02, // 0x80010a80

    0x6C,0x00,0x80,0x01,0x00,0x60,0x00,0x00, // 0x80010a88

    0x76,0x02,0x0D,0x02,0x00,0x20,0x00,0x00, // 0x80010a90

    0x6E,0x00,0x00,0x02,0x00,0x60,0x00,0x00, // 0x80010a98

    0xE6,0x42,0x10,0x02,0x0A,0x7F,0x13,0x02, // 0x80010aa0

    0x5A,0x2A,0x10,0x00,0x20,0xA1,0x14,0x20, // 0x80010aa8

    0x6E,0x00,0x00,0x02,0xE6,0x42,0x10,0x02, // 0x80010ab0

    0x0A,0x7F,0x13,0x02,0x00,0x00,0x10,0xE0, // 0x80010ab8

    0x5A,0x2A,0x10,0x00,0x20,0xA1,0xFC,0x3F, // 0x80010ac0

    0x58,0xA3,0x04,0x02,0x52,0x08,0x80,0x07, // 0x80010ac8

    0x62,0xA3,0x8C,0x00,0x00,0x00,0x00,0x00, // 0x80010ad0

    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 0x80010ad8

    0x59,0x00,0x90,0x02,0x5B,0x6F,0x90,0x02, // 0x80010ae0

    0xAB,0x0D,0x00,0x03,0xA1,0x01,0x18,0x01, // 0x80010ae8

    0x42,0x09,0x90,0x03,0xA1,0x67,0x94,0x01, // 0x80010af0

    0xF8,0xDB,0x18,0x03,0x79,0x7A,0x94,0x01, // 0x80010af8

    0xDA,0x00,0x90,0x02,0xD8,0x2D,0x8C,0x01, // 0x80010b00

    0xF8,0xCF,0x8C,0x00,0x10,0x22,0x00,0x80, // 0x80010b08

    0x5A,0x6F,0x14,0x03,0x5A,0x10,0x90,0x02, // 0x80010b10

    0x5A,0x2F,0x18,0x00,0x58,0x2F,0x88,0x01, // 0x80010b18

    0x5A,0x10,0x0C,0x80,0x5B,0x20,0x10,0x22, // 0x80010b20

    0xA3,0x47,0x98,0x00,0xA7,0x02,0x1C,0x24, // 0x80010b28

    0xF8,0x50,0x18,0x01,0x87,0x36,0x90,0x43, // 0x80010b30

    0xE3,0x03,0x04,0x03,0x5A,0x20,0x94,0x22, // 0x80010b38

    0x5B,0xCF,0x9B,0x0F,0x58,0x10,0x10,0x02, // 0x80010b40

    0xA2,0x59,0x08,0x02,0xA2,0x03,0xFC,0x00, // 0x80010b48

    0x37,0x02,0x14,0x24,0x5A,0x40,0x13,0x00, // 0x80010b50

    0xD6,0x36,0x94,0x43,0x64,0x36,0x90,0x01, // 0x80010b58

    0x91,0x08,0x00,0x20,0x5B,0xE0,0x03,0x20, // 0x80010b60

    0x64,0x36,0x90,0x01,0x91,0x08,0x00,0x20, // 0x80010b68

    0x5B,0xE0,0x03,0x20,0x64,0x36,0x90,0x01, // 0x80010b70

    0x91,0x08,0x00,0x20,0x5B,0xE0,0x03,0x20, // 0x80010b78

    0x64,0x36,0x90,0x01,0x91,0x04,0x00,0x20, // 0x80010b80

    0x5B,0xE0,0x03,0x20,0x64,0x36,0x90,0x01, // 0x80010b88

    0x59,0x50,0x93,0x00,0x5B,0x10,0x0C,0x02, // 0x80010b90

    0x91,0x04,0x00,0x20,0xA3,0xE1,0x03,0x20, // 0x80010b98

    0x64,0x36,0x90,0x01,0x59,0xE0,0x87,0x80, // 0x80010ba0

    0xF7,0x36,0x14,0x02,0x5B,0x10,0x0C,0x02, // 0x80010ba8

    0x91,0x00,0x00,0x20,0xA3,0xE1,0x03,0x20, // 0x80010bb0

    0x64,0x36,0x90,0x81,0x59,0x2F,0x88,0x00, // 0x80010bb8

    0xF7,0x36,0x14,0x02,0x5A,0x10,0x0C,0x02, // 0x80010bc0

    0xF7,0x36,0x14,0x02,0x5A,0x10,0x0C,0x02, // 0x80010bc8

    0xF7,0x36,0x14,0x02,0x5A,0x10,0x0C,0x02, // 0x80010bd0

    0xA3,0x03,0x98,0x00,0xF7,0x36,0x14,0x02, // 0x80010bd8

    0x5A,0x10,0x0C,0x02,0x5B,0x5F,0x08,0x00, // 0x80010be0

    0xF6,0x36,0x14,0x02,0x5A,0x10,0x10,0x02, // 0x80010be8

    0x86,0x36,0x10,0x23,0xA7,0x02,0x10,0x82, // 0x80010bf0

    0x10,0x1D,0x00,0x00,0x62,0x03,0x0C,0x00, // 0x80010bf8

    0x58,0x00,0x14,0x02,0x00,0x00,0x00,0x00, // 0x80010c00

    0xD6,0x36,0x14,0x23,0xB6,0x02,0x14,0x82, // 0x80010c08

    0x59,0x4F,0x88,0x00,0xA6,0x36,0x90,0x23, // 0x80010c10

    0xA6,0x36,0x10,0x83,0x5A,0x9F,0x08,0x01, // 0x80010c18

    0x58,0x0F,0x0B,0x01,0xA6,0x36,0x90,0x84, // 0x80010c20

    0xB6,0x36,0x94,0x23,0xB6,0x36,0x14,0x83, // 0x80010c28

    0xA6,0x36,0x10,0x63,0xA6,0x36,0x10,0x64, // 0x80010c30

    0xA6,0x36,0x90,0x63,0xA7,0x36,0x10,0x68, // 0x80010c38

    0x90,0x0F,0x00,0xB0,0xB7,0x36,0x94,0x84, // 0x80010c40

    0x58,0x10,0x10,0x02,0xB6,0x36,0x14,0x63, // 0x80010c48

    0xB6,0x36,0x14,0x64,0xB6,0x36,0x94,0x63, // 0x80010c50

    0xB6,0x36,0x14,0x68,0xE3,0x03,0x04,0x03, // 0x80010c58

    0x24,0x36,0x90,0x01,0x5A,0xCF,0x1B,0x02, // 0x80010c60

    0xA2,0x03,0x90,0x00,0x11,0x08,0x00,0x00, // 0x80010c68

    0x24,0x36,0x90,0x01,0x11,0x08,0x00,0x00, // 0x80010c70

    0x24,0x36,0x90,0x01,0x11,0x08,0x00,0x00, // 0x80010c78

    0x24,0x36,0x90,0x01,0x5B,0x50,0x0B,0x00, // 0x80010c80

    0x11,0x04,0x00,0x00,0x24,0x36,0x90,0x01, // 0x80010c88

    0x59,0x40,0x8B,0x00,0x5B,0x10,0x0C,0x02, // 0x80010c90

    0x11,0x04,0x00,0x00,0x24,0x36,0x90,0x01, // 0x80010c98

    0x59,0xE0,0x87,0x80,0xB7,0x36,0x14,0x02, // 0x80010ca0

    0x5B,0x10,0x0C,0x02,0x11,0x00,0x00,0x20, // 0x80010ca8

    0xA3,0xE1,0x03,0x20,0x24,0x36,0x90,0x81, // 0x80010cb0

    0xA2,0x03,0x98,0x00,0x62,0x03,0x0C,0x00, // 0x80010cb8

    0x58,0x00,0x14,0x02,0x00,0x40,0x00,0x00, // 0x80010cc0

    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 0x80010cc8

    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 0x80010cd0

    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 0x80010cd8

    0x59,0xEA,0x93,0x00,0xF4,0x94,0xBC,0x05, // 0x80010ce0

    0x59,0x00,0x04,0x01,0x91,0x16,0x00,0x80, // 0x80010ce8

    0xF5,0x22,0x3C,0x05,0x40,0x09,0x10,0x05, // 0x80010cf0

    0xA9,0xFF,0xFF,0xA1,0xF4,0x42,0x3C,0x06, // 0x80010cf8

    0xE9,0xFF,0xFF,0xA1,0xF4,0x62,0xBC,0x06, // 0x80010d00

    0x65,0x36,0xA8,0x90,0x58,0xEA,0x8F,0xA0, // 0x80010d08

    0x58,0x10,0x8C,0x06,0x00,0x00,0x00,0x00, // 0x80010d10

    0x28,0xFC,0x7F,0x06,0x00,0x00,0x00,0x00, // 0x80010d18

    0x10,0x0D,0x00,0x90,0x58,0x00,0x84,0x01, // 0x80010d20

    0x00,0x60,0x00,0x00,0x59,0x00,0x8C,0x05, // 0x80010d28

    0x11,0xB8,0xFF,0x0F,0x64,0x02,0x28,0x02, // 0x80010d30

    0x5A,0x90,0x28,0x02,0x2A,0xA6,0x86,0x01, // 0x80010d38

    0x58,0x00,0x0C,0x03,0xEA,0x00,0xC0,0x01, // 0x80010d40

    0x00,0x00,0x00,0x00,0x78,0x40,0xAD,0x01, // 0x80010d48

    0x58,0x60,0x8D,0x01,0x78,0x8F,0x8D,0x01, // 0x80010d50

    0x58,0x80,0x0C,0x05,0x64,0x20,0xA8,0x00, // 0x80010d58

    0x00,0x60,0x00,0x00,0x2B,0xA6,0x86,0x81, // 0x80010d60

    0x59,0x00,0x84,0x01,0x5B,0x90,0x28,0x82, // 0x80010d68

    0x10,0xFD,0xFF,0x8F,0x10,0xB0,0xFF,0x8F, // 0x80010d70

    0x64,0x02,0x28,0x82,0x58,0x00,0x8C,0x85, // 0x80010d78

    0xEA,0x00,0xC0,0x81,0x58,0x00,0x0C,0x83, // 0x80010d80

    0xA8,0xFF,0xFF,0x01,0xE8,0xFF,0xFF,0x01, // 0x80010d88

    0x58,0xEA,0x8F,0x00,0x59,0x00,0x04,0x01, // 0x80010d90

    0x91,0x0C,0x00,0x80,0x64,0x02,0x8C,0x90, // 0x80010d98

    0x58,0x00,0x0C,0xB5,0xA8,0x00,0x80,0xA0, // 0x80010da0

    0x00,0x20,0x00,0x00,0x90,0x08,0x00,0x90, // 0x80010da8

    0x00,0x80,0x00,0x00,0x62,0x13,0x04,0x00, // 0x80010db0

    0x2A,0xE4,0x86,0x01,0xEA,0x00,0xC0,0x01, // 0x80010db8

    0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00, // 0x80010dc0

    0x64,0x32,0xA8,0x00,0x00,0x60,0x00,0x00, // 0x80010dc8

    0x90,0x00,0x00,0x80,0x62,0x13,0x04,0x80, // 0x80010dd0

    0x2A,0xE4,0x86,0x81,0xEA,0x00,0xC0,0x81, // 0x80010dd8

    0x00,0x20,0x00,0x00,0x5B,0x10,0xB4,0x01, // 0x80010de0

    0xE4,0x22,0x3C,0x05,0x63,0x03,0x0C,0x00, // 0x80010de8

    0xE4,0x23,0x3C,0x06,0xE4,0x92,0xBC,0x05, // 0x80010df0

    0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00, // 0x80010df8

    0x29,0x0E,0x88,0x01,0xF5,0x54,0xBC,0x05, // 0x80010e00

    0xAA,0xFF,0x7F,0x02,0xE8,0x00,0xC0,0x01, // 0x80010e08

    0x64,0x02,0x8C,0x01,0xF4,0x22,0x3C,0x05, // 0x80010e10

    0xEA,0xFF,0x7F,0x02,0xAA,0xFF,0xFF,0x02, // 0x80010e18

    0x7A,0x8A,0x94,0x02,0x58,0x0A,0x8C,0x01, // 0x80010e20

    0xFA,0xBF,0x0C,0x00,0x29,0x10,0x88,0x21, // 0x80010e28

    0x12,0x08,0x00,0x20,0x63,0x03,0x10,0x30, // 0x80010e30

    0xE8,0x00,0xC0,0x21,0x64,0x02,0x8C,0x21, // 0x80010e38

    0x58,0x00,0x10,0x05,0x2A,0x28,0x87,0x01, // 0x80010e40

    0xEA,0x00,0xC0,0x01,0x00,0x00,0x00,0x00, // 0x80010e48

    0x28,0x10,0x88,0x01,0xE8,0x00,0xC0,0x01, // 0x80010e50

    0x64,0x02,0x8C,0x01,0x00,0x40,0x00,0x00, // 0x80010e58

    0x2A,0x38,0x87,0x01,0x62,0x13,0x0C,0x00, // 0x80010e60

    0xEA,0x00,0xC0,0x01,0x00,0x60,0x00,0x00, // 0x80010e68

    0x2A,0x0C,0x08,0x02,0xEA,0x00,0x40,0x02, // 0x80010e70

    0xE6,0x02,0x10,0x00,0x58,0x00,0x28,0x02, // 0x80010e78

    0x2A,0x54,0x87,0x01,0xEA,0x00,0xC0,0x01, // 0x80010e80

    0x00,0x00,0x00,0x00,0x29,0x0A,0x88,0x31, // 0x80010e88

    0x12,0x07,0x00,0x30,0x63,0x03,0x00,0x20, // 0x80010e90

    0xE8,0x00,0xC0,0x31,0x64,0x02,0x8C,0x30, // 0x80010e98

    0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, // 0x80010ea0

    0x28,0x0A,0x88,0x01,0xE8,0x00,0xC0,0x01, // 0x80010ea8

    0x64,0x02,0x8C,0x00,0x00,0x40,0x00,0x00, // 0x80010eb0

    0x2A,0x68,0x87,0x01,0x10,0x06,0x00,0x90, // 0x80010eb8

    0x62,0x13,0x04,0x80,0xEA,0x00,0xC0,0x01, // 0x80010ec0

    0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, // 0x80010ec8

    0x28,0x12,0x88,0x01,0xE8,0x00,0xC0,0x01, // 0x80010ed0

    0x64,0x02,0x8C,0x01,0x2A,0x78,0x87,0x01, // 0x80010ed8

    0xEA,0x00,0xC0,0x01,0x00,0x20,0x00,0x00, // 0x80010ee0

    0x62,0x13,0x0C,0x00,0x00,0x80,0x00,0x00, // 0x80010ee8

    0x10,0x14,0x00,0x00,0x2A,0x80,0x87,0x01, // 0x80010ef0

    0xEA,0x00,0xC0,0x01,0x00,0x40,0x00,0x00, // 0x80010ef8

    0x10,0x00,0x00,0x00,0x00,0x80,0x00,0x00, // 0x80010f00

    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 0x80010f08

    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 0x80010f10

    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 0x80010f18

    0xA8,0xFF,0xFF,0x02,0x2B,0x40,0x84,0x02, // 0x80010f20

    0xA8,0xFF,0x7F,0x02,0xEB,0x00,0xC0,0x02, // 0x80010f28

    0xE8,0xFF,0xFF,0x02,0x63,0x03,0x14,0x00, // 0x80010f30

    0xA1,0x01,0x94,0x01,0x78,0xAA,0x90,0x00, // 0x80010f38

    0xF9,0x00,0x00,0x02,0x64,0x02,0x0C,0x92, // 0x80010f40

    0xF8,0x00,0x80,0x01,0x58,0x80,0x94,0x91, // 0x80010f48

    0x5A,0x10,0x0C,0x02,0x00,0x00,0x00,0x00, // 0x80010f50

    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 0x80010f58

    0x62,0x03,0x0C,0x00,0x00,0x80,0x00,0x00, // 0x80010f60

    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 0x80010f68

    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 0x80010f70

    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 0x80010f78

    0x00,0x00,0x00,0x00,0x90,0x00,0x00,0x00, // 0x80010f80

    0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00, // 0x80010f88

    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 0x80010f90

    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 0x80010f98

    0x04,0x00,0x00,0x00,0x14,0x10,0x01,0x80, // 0x80010fa0

    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 0x80010fa8

    0x04,0x00,0x00,0x00,0x18,0x10,0x01,0x80, // 0x80010fb0

    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 0x80010fb8

    0x04,0x00,0x00,0x00,0x1C,0x10,0x01,0x80, // 0x80010fc0

    0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 0x80010fc8

    0x04,0x00,0x00,0x00,0x28,0x10,0x01,0x80, // 0x80010fd0

    0x00,0x20,0xC2,0x01,0x00,0x00,0x00,0x00, // 0x80010fd8

    0x04,0x00,0x00,0x00,0x2C,0x10,0x01,0x80, // 0x80010fe0

    0x00,0x40,0xC1,0x01,0x00,0x00,0x00,0x00, // 0x80010fe8

    0x04,0x00,0x00,0x00,0x20,0x10,0x01,0x80, // 0x80010ff0

    0x60,0x0F,0x01,0x80,0x00,0x00,0x00,0x00, // 0x80010ff8

    0x04,0x00,0x00,0x00,0x24,0x10,0x01,0x80, // 0x80011000

    0x60,0x0F,0x01,0x80,0x00,0x00,0x00,0x00, // 0x80011008

    0x00,0x00,0x00,0x00,

};

 

uint32_t dsp_init() 

{

    memcpy((void*)0x80010000, dsp_80010000, sizeof(dsp_80010000));

    memcpy((void*)0x80010880, dsp_80010880, sizeof(dsp_80010880));


    return dsp_start_addr;

}


 

  • By the way, unlike this post: http://e2e.ti.com/support/dsp/omap_applications_processors/f/42/t/83672.aspx, which states that the ARM boots with the DSP disabled:

    PSC0.MDSTAT15 values:

    After device boot:  0x0000A00
    After DSP PSC enable:  0x00001E03
    After deasserting DSP local reset:  0x00001D03

    What I see when booting the ARM via JTAG (emulation dip switches) is that the DSP is already enabled:

    PSC0->MDSTAT[15] == 0x00001D03

    The datasheet seems to imply that the DSP will only start running DSP code at address SYSCONFIG->HOST1CFG exactly once, when local reset is deasserted after *initial ARM boot*...

    How do I restart the DSP to start executing from HOST1CFG a second time, and why is my OMAP-L138 booting to ARM code with the DSP still enabled?

     

    Thanks,
    Martin

  • Martin,

    Your general procedure seems correct.  I have a few comments and questions:

    1. Is the entrypoint of your DSP application actually 0x80010000, or is that just the start of the DSP image?  The entrypoint should be listed in the MAP file as _c_int00 unless you specify a custom entrypoint (i.e. using the -e option).  To make the DSP run correctly, your entrypoint will need to be aligned to a 0x400-byte boundary.  (The address 0x80010000 is properly aligned.)
    2. I'm not sure you should re-lock the kick registers after touching the HOST1CFG register.  Unless your other steps (PSC, release from reset) unlock the registers again, this could cause them to fail.
    3. You don't need to disable the DSP as the first step in your ARM application.  The DSP should already be powered down when the device leaves reset.  Emulation boot is a special case in which the ARM bootloader wakes up the DSP and both CPUs enter idle loops instead of running actual applications.  A "normal" boot process via some peripheral access (UART, flash memory, etc.) will not wake up the DSP.

    Hope this helps.  Let me know if you have any additional questions.

  • Hi Joe,

    1) Yes, the c_int00 starts at 0x80010000.  This has been verified with the map file, the xml dump tool, and code composer objdump.

    2) Ok, when should the KICK registers be relocked?  I can run the whole program with a permanent unlock, but I think I tried that and noticed no difference.

    3) Yes, under JTAG the DSP boots enabled.  I'm starting to suspect this is the problem -- that once the DSP is enabled, it is impossible to locally reset it and have it run code from scratch from HOST1CFG.  I'll try booting from NOR, and see if there is a difference.  But is this a known limitation?  Is it true that the DSP can only be enabled to start running code exactly once, and that testing ARM booting of DSP under JTAG is not possible?

    Martin

  • I tried leaving the SYSCONFIG registers unlocked.  The issue remains.  Any other suggestions?  Can TI confirm that the DSP can be restarted and properly run code at HOST1CFG in emulation?

    Thanks,
    Martin

  • Martin Turon said:

    By the way, unlike this post: http://e2e.ti.com/support/dsp/omap_applications_processors/f/42/t/83672.aspx, which states that the ARM boots with the DSP disabled:

     

    PSC0.MDSTAT15 values:

    After device boot:  0x0000A00
    After DSP PSC enable:  0x00001E03
    After deasserting DSP local reset:  0x00001D03

    What I see when booting the ARM via JTAG (emulation dip switches) is that the DSP is already enabled:

    PSC0->MDSTAT[15] == 0x00001D03

    When using the emulation boot mode, both the DSP and ARM will be awake and connectable by a JTAG emulator since this will ease the user's development from a host computer.  For all other boot modes, the DSP will be disabled (in reset).

    Regards, Daniel

  • Martin Turon said:
    Is it true that the DSP can only be enabled to start running code exactly once, and that testing ARM booting of DSP under JTAG is not possible?

    No, this is not true. The DSP can be independently shutdown and restarted without limitation.  Testing ARM booting of DSP is best done in a boot mode that reflects how the device would be booted in actual practice (any mode other than emulation boot mode).  But the code you show where the DSP is disabled first should be acceptable as well.

    Regards, Daniel

  • Hi Daniel,

    I tried booting this from the SPI flash, but it didn't work that way either.  Are you able to run this and get it to work?  Again, the encoded DSP binary is the blink LED sample.  The ARM is simply trying to load that dynamically, and restart the DSP to run the code.

    "Testing ARM booting of DSP is best done in a boot mode that reflects how the device would be booted in actual practice (any mode other than emulation boot mode)"

    I would like to test ARM booting of DSP in emulation mode (using JTAG so I can single step the ARM code).  Could you clarify whether or not the CPU allows this?  

    Regards,
    Martin

  • If you haven't seen this, you might want to review this wiki page:

    http://processors.wiki.ti.com/index.php/Boot_Images_for_OMAP-L138

    It gives examples that show booting from the ARM and kicking off the DSP. I'll try to create and test and example that shows this in emulation boot mode, as that page expects you to actually perform a boot.

    Regards, Daniel

  • Hi Daniel,

    Yes, I've looked at that page a number of times.  I'll attempt to replicate the AIS based boot-from-SPI-NOR solution outlined there.  I suspect at this point one of three things:

    1) The AIS bootloader does something extra that isn't documented on that page which is necessary to start the DSP
    2) The PLL settings aren't correct, and so the DSP doesn't start despite everything else being correct
    3) The DSP  code can't be as simple as it is currently, but rather must include an IRQ vector and handler for NMI interrupt, and ARM must trigger this interrupt as part of the wake up procedure:    SYSCONFIG->CHIPSIG     |= (1<<4); // Send NMI interrupt to wake DSP out of sleep

    Thanks for trying to run the code above in emulation.  I look forward to hearing how well it works in your environment.

    Regards,
    Martin

  • I tinkered with this a bit today and discovered that all code samples that do this put the DSP into the SWRSTDISABLE (0x0), not simply the DISABLE (0x2) state.  Sure enough, when I try your code which just does DISABLE, I couldn't get the DSP to come back up when I went to enable it.  Changing the code to use SWRSTDISABLE in the disable function let things work as expected.  I'll have to investigate this a little more, but I suggest you try that in your code and see if that lets you move forward. I'll post my own code when I've completed my work.

    Regards, Daniel

  • Hi Daniel,

    Yes, I had also noticed UBL and other samples use SWRSTDISABLE, and confirmed that SWRSTDISABLE sets PSC0.MDSTAT15 to the expected boot value (0x0A00).  So I have actually been using that setting for the past few days.  It still isn't working for me.  I'm glad to hear you are getting promising results.  I look forward to discover the missing detail that is preventing correct operation in my environment.

    Regards,
    Martin

  • Martin,

    With some more rigourous testing, it turns out that the PSC state which I use for disabling does not have any affect.  I'm attaching the code I used - you can just create a simple CCS ARM project around the three files, and it's complete on it's own (no header or library dependencies outside of the standard C compiler RTS library).

    The example shows shutting down and starting back up the DSP three times, at a different address each time.  The reset address we give to the DSP through the HOSTCFG1 register is in the last 32KB of the DSP's ROM memory, which is filled with IDLE instructions, so that the DSP basically just sits there doing nothing as soon as it comes out of reset.

    I tried single stepping through the program, and also letting it run free.  I tried using PSC_DISABLE and PSC_SWRSTDISABLE (configured using a #define at the top of the file).  I tried running the code on the ARM with the DSP initially connected and with it initially unconnected. Everything pretty much worked.

    My test results are shown below:

    Test 1:
      DSP Unconnected with Emulator at start of ARM program
      Use Disable(0x02) for disable LPSC state
      Resume (F8) through ARM program

    [ARM9_0] DSP Starts as PSC0->MDSTAT[LPSC_DSP] = 0x00001d03
    [ARM9_0] DSP Disabled? PSC0->MDSTAT[LPSC_DSP] = 0x00000e02
    [ARM9_0] DSP Enabled?  PSC0->MDSTAT[LPSC_DSP] = 0x00001d03
    [ARM9_0] DSP Disabled? PSC0->MDSTAT[LPSC_DSP] = 0x00000e02
    [ARM9_0] DSP Enabled?  PSC0->MDSTAT[LPSC_DSP] = 0x00001d03
    [ARM9_0] DSP Disabled? PSC0->MDSTAT[LPSC_DSP] = 0x00000e02
    [ARM9_0] DSP Enabled?  PSC0->MDSTAT[LPSC_DSP] = 0x00001d03

    DSP is connectable after completion of ARM program



    Test 2:
      DSP Connected with Emulator at start of ARM program
      Use Disable(0x02) for disable LPSC state
      Resume (F8) through ARM program

    [ARM9_0] DSP Starts as PSC0->MDSTAT[LPSC_DSP] = 0x00001d03
    [ARM9_0] DSP Disabled? PSC0->MDSTAT[LPSC_DSP] = 0x00000e02
    [ARM9_0] DSP Enabled?  PSC0->MDSTAT[LPSC_DSP] = 0x00001d03
    [ARM9_0] DSP Disabled? PSC0->MDSTAT[LPSC_DSP] = 0x00000e02
    [ARM9_0] DSP Enabled?  PSC0->MDSTAT[LPSC_DSP] = 0x00001d03
    [ARM9_0] DSP Disabled? PSC0->MDSTAT[LPSC_DSP] = 0x00000e02
    [ARM9_0] DSP Enabled?  PSC0->MDSTAT[LPSC_DSP] = 0x00001d03

    DSP is connectable after completion of ARM program



    Test 3:
      DSP Unconnected with Emulator at start of ARM program
      Use SWRstDisable(0x00) for disable LPSC state
      Resume (F8) through ARM program

    [ARM9_0] DSP Starts as PSC0->MDSTAT[LPSC_DSP] = 0x00001d03
    [ARM9_0] DSP Disabled? PSC0->MDSTAT[LPSC_DSP] = 0x00000a00
    [ARM9_0] DSP Enabled?  PSC0->MDSTAT[LPSC_DSP] = 0x00001d03
    [ARM9_0] DSP Disabled? PSC0->MDSTAT[LPSC_DSP] = 0x00000a00
    [ARM9_0] DSP Enabled?  PSC0->MDSTAT[LPSC_DSP] = 0x00001d03
    [ARM9_0] DSP Disabled? PSC0->MDSTAT[LPSC_DSP] = 0x00000a00
    [ARM9_0] DSP Enabled?  PSC0->MDSTAT[LPSC_DSP] = 0x00001d03

    DSP is connectable after completion of ARM program



    Test 4:
      DSP Connected with Emulator at start of ARM program
      Use SWRstDisable(0x00) for disable LPSC state
      Resume (F8) through ARM program

    [ARM9_0] DSP Starts as PSC0->MDSTAT[LPSC_DSP] = 0x00001d03
    [ARM9_0] DSP Disabled? PSC0->MDSTAT[LPSC_DSP] = 0x00000a00
    [ARM9_0] DSP Enabled?  PSC0->MDSTAT[LPSC_DSP] = 0x00001d03
    [ARM9_0] DSP Disabled? PSC0->MDSTAT[LPSC_DSP] = 0x00000a00
    [ARM9_0] DSP Enabled?  PSC0->MDSTAT[LPSC_DSP] = 0x00001d03
    [ARM9_0] DSP Disabled? PSC0->MDSTAT[LPSC_DSP] = 0x00000a00
    [ARM9_0] DSP Enabled?  PSC0->MDSTAT[LPSC_DSP] = 0x00001d03

    DSP is connectable after completion of ARM program



    Test 5:
      DSP Unconnected with Emulator at start of ARM program
      Use Disable(0x02) for disable LPSC state
      Single-step over through ARM program

    [ARM9_0] DSP Starts as PSC0->MDSTAT[LPSC_DSP] = 0x00001d03
    [ARM9_0] DSP Disabled? PSC0->MDSTAT[LPSC_DSP] = 0x00000e02
    [ARM9_0] DSP Enabled?  PSC0->MDSTAT[LPSC_DSP] = 0x00001d03
    [ARM9_0] DSP Disabled? PSC0->MDSTAT[LPSC_DSP] = 0x00000e02
    [ARM9_0] DSP Enabled?  PSC0->MDSTAT[LPSC_DSP] = 0x00001d03
    [ARM9_0] DSP Disabled? PSC0->MDSTAT[LPSC_DSP] = 0x00000e02
    [ARM9_0] DSP Enabled?  PSC0->MDSTAT[LPSC_DSP] = 0x00001d03

    DSP is connectable after completion of ARM program



    Test 6:
      DSP Connected with Emulator at start of ARM program
      Use Disable(0x02) for disable LPSC state
      Single-step over through ARM program

    [ARM9_0] DSP Starts as PSC0->MDSTAT[LPSC_DSP] = 0x00001d03
    [ARM9_0] DSP Disabled? PSC0->MDSTAT[LPSC_DSP] = 0x00000e02
    [ARM9_0] DSP Enabled?  PSC0->MDSTAT[LPSC_DSP] = 0x00021d03
    [ARM9_0] DSP Disabled? PSC0->MDSTAT[LPSC_DSP] = 0x00020e02
    [ARM9_0] DSP Enabled?  PSC0->MDSTAT[LPSC_DSP] = 0x00021d03
    [ARM9_0] DSP Disabled? PSC0->MDSTAT[LPSC_DSP] = 0x00020e02
    [ARM9_0] DSP Enabled?  PSC0->MDSTAT[LPSC_DSP] = 0x00021d03

    DSP is connectable after completion of ARM program



    Test 7:
      DSP Unconnected with Emulator at start of ARM program
      Use SWRstDisable(0x00) for disable LPSC state
      Single-step over through ARM program

    [ARM9_0] DSP Starts as PSC0->MDSTAT[LPSC_DSP] = 0x00001d03
    [ARM9_0] DSP Disabled? PSC0->MDSTAT[LPSC_DSP] = 0x00000a00
    [ARM9_0] DSP Enabled?  PSC0->MDSTAT[LPSC_DSP] = 0x00001d03
    [ARM9_0] DSP Disabled? PSC0->MDSTAT[LPSC_DSP] = 0x00000a00
    [ARM9_0] DSP Enabled?  PSC0->MDSTAT[LPSC_DSP] = 0x00001d03
    [ARM9_0] DSP Disabled? PSC0->MDSTAT[LPSC_DSP] = 0x00000a00
    [ARM9_0] DSP Enabled?  PSC0->MDSTAT[LPSC_DSP] = 0x00001d03

    DSP is connectable after completion of ARM program



    Test 8:
      DSP Connected with Emulator at start of ARM program
      Use SWRstDisable(0x00) for disable LPSC state
      Single-step over through ARM program

    [ARM9_0] DSP Starts as PSC0->MDSTAT[LPSC_DSP] = 0x00001d03
    [ARM9_0] DSP Disabled? PSC0->MDSTAT[LPSC_DSP] = 0x00000a00
    [ARM9_0] DSP Enabled?  PSC0->MDSTAT[LPSC_DSP] = 0x00021d03
    [ARM9_0] DSP Disabled? PSC0->MDSTAT[LPSC_DSP] = 0x00020a00
    [ARM9_0] DSP Enabled?  PSC0->MDSTAT[LPSC_DSP] = 0x00021d03
    [ARM9_0] DSP Disabled? PSC0->MDSTAT[LPSC_DSP] = 0x00020a00
    [ARM9_0] DSP Enabled?  PSC0->MDSTAT[LPSC_DSP] = 0x00021d03

    DSP is connectable after completion of ARM program


    Please let me know if you have any questions about this.

    Regards, Daniel

    DSP_Start_Test.zip
  • I should also point out that I did not do anything with KICK registers since in the silicon sample I have (2.0), the KICK registers are no longer functional. But if you need to unlock them, I suggest you do it once and never touch them again.

    Regards, Daniel