Storing Data in Memory from Custom Flash Loader Topic is solved

If you have a simple question and just want an answer.
User avatar
Caleb
Experienced Member
Posts: 82
Joined: Thu Apr 04, 2013 10:14 pm

Storing Data in Memory from Custom Flash Loader

Post by Caleb »

I hoped to store a small amount of data in memory from the custom flash loader. I though that perhaps the Deep Sleep Memory would be useful. However, writing to DSM from Custom Flash Loader causes loader to hang . I can't tell what is happening. 
 
#include <platform.h>
void init( void )
{
    unsigned char reg_data[ 1 ];
    reg_data[0] = 0xca;
//    write_periph_8( usb_tile, 3, 0xff, 1, reg_data );
}
int checkCandidateImageVersion ( int v ){return v;}
void recordCandidateImage( int v, unsigned adr ){}
unsigned reportSelectedImage( void ){return 0;}
 

​using this as a the custom loader, the main program boots and runs. But, uncomment the write_periph_8 instruction - no boot. 
dump-state (same results each run):
***** Active Cores *****
* 1  tile[0] core[0]  0x0001fbb6 in ?? ()
 
Thread 1 (tile[0] core[0]):
 
***** Call Stack *****
#0  0x0001fbb6 in ?? ()
 
***** Disassembly *****
0x1fbb6:        inct (2r)       r1, res[r0] *
0x1fbb8:        chkct (rus)     res[r0], 0x1 *
0x1fbba:        eq (2rus)       r0, r1, 0x3
0x1fbbc:        ldw (ru6)       r4, sp[0x0]
0x1fbbe:        retsp (u6)      0x1
 
***** Registers *****
r0             0x102    258
r1             0x3      3
r2             0x1ff4c  130892
r3             0x1      1
r4             0x0      0
r5             0x10a24  68132
r6             0xffffffa0       -96
r7             0x0      0
r8             0x0      0
r9             0x0      0
r10            0x0      0
r11            0x1      1
cp             0x1fd4c  130380
dp             0x1fda8  130472
sp             0x1ff30  130864
lr             0x1f710  128784
pc             0x1fbb6  129974
sr             0x40     64
spc            0x0      0
ssr            0x0      0
et             0x0      0
ed             0x0      0
sed            0x0      0
kep            0x10080  65664
ksp            0x0      0

Can you identify the problem?

View Solution
colin
Experienced Member
Posts: 74
Joined: Mon Dec 16, 2013 12:14 pm

Post by colin »

Hi Caleb,

The link between the xcore and USB device is not enabled when the custom bootloader init function is called, therefore when the write_periph_8( usb_tile, 3, 0xff, 1, reg_data ) call is made the xcore sends the message to the USB tile and awaits the response indefinitely (it will never get one).

The link between the xcore and usb tile is only enabled after the correct image to be booted is found (the network setup code is embedded in the image).

If you need to save a word into memory then there are 32 words reserved for debug at the very top of the xcore memory that you can use in your custom bootloader.

Regards,

Colin.