Hi
When I load code (that runs in RAM) I use these two steps in the sequence:
case 6:
fnSDP(SDP_COMMAND_TYPE_WRITE_FILE, (unsigned long)LOAD_ADDRESS, 0, 0, ulFileLength); // start SDP sequence setup (and prepare its data)
break;
case 7:
fnSDP(SDP_COMMAND_TYPE_JUMP_ADDRESS, (unsigned long)LOAD_ADDRESS, 0, 0, 0); // start SDP sequence setup (and prepare its data)
LOAD_ADDRESS is defined to be
#define LOAD_ADDRESS 0x20208200 // in OCRAM
since the code that is load is linked to operate there (the FlexRAM defaults are valid).
The file that I load has an image vector table at the start - this is its binary:
0xd1,0x00,0x20,0x40,0xf9,0xad,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 0x00..0x0f
0x00,0x82,0x20,0x20,0x00,0x82,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 0x10..0x1f
0x00,0x82,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 0x20..0x2f
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 0x30..0x3f
...
whereby the image vector table is defined as
typedef struct stIMAGE_VECTOR_TABLE_LOADER {
unsigned long hdr; // header tag that must be IVT_HEADER
unsigned long entry; // absolute address of the first instruction to execute from the
unsigned long reserved1; // reserved in this version of HAB (high assurance boot): should be NULL
unsigned long dcd; // absolute address of the image DCD: may be NULL
unsigned long boot_data; // absolute address of the boot data: may be NULL, but not interpreted any further by HAB
unsigned long self; // absolute address of the IVT
unsigned long csf; // absolute address of the image CSF
unsigned long reserved2; // reserved in this version of HAB: should be zero
unsigned long ulEntry;
unsigned long ulLength;
unsigned long ulRes[118];
} IMAGE_VECTOR_TABLE_LOADER;
Therefore you can't load the same image as you load with the debugger (which will start with a reset vector).
When I build my own projects I use a define "SDP_LOADER" to control outputting two binary files - one that can be loaded with the debugger (and other standard techniques) and one that can be loaded via SDP. That define controls inserting the necessary header and a few other changes (which are more due to the fact that I build as production loader tool to subsequently load code to Flash).
Regards
Mark