AnsweredAssumed Answered

boot.c code runs with debugger but wont run without it!?

Question asked by Carl Norman on Mar 12, 2010
Latest reply on Mar 14, 2010 by Carl Norman



I am using the Cyclone MAX, CW7.1.2, MQX3.5 and 52259evb.


I have some code running in boot.c to illustrate the issue. The code is like this:




// Inside boot.c

asm void __boot(void) {
// MQX boot code as normal
// Modified last line only
         jsr bootloader_init 

typedef void(*pt2Func1)(void);
extern volatile pt2Func1 fp_mcf5225_init_image2;
extern volatile pt2Func1 fp_start_image2;

void bootloader_init(void)
pt2Func1 _MQX_BOOT1;
pt2Func1 _MQX_BOOT2;
        _MQX_BOOT1 = fp_mcf5225_init_image2; //From MRAM
        _MQX_BOOT2 = fp_start_image2; //From MRAM



The above code is in MRAM by way of this lcf entry:


        Boot.c (.data)
        Boot.c (.rodata)
        Boot.c (.text)
    } > MBL   //(RX): ORIGIN = 0x1005E000, LENGTH = 0x00001FD0


The two MQX boot variables are in MRAM something like this:



// MBR_2.c
typedef void(*pt2Func1)(void);
extern void mcf5225_init(void);      
extern void _start(void);

volatile pt2Func1 fp_mcf5225_init_image2 = mcf5225_init;        //Boot location image 2
volatile pt2Func1 fp_start_image2 = _start;                        //Boot location image 2



And the above variables are put in MRAM by this



        MBR_2.c (.data)
        MBR_2.c (.rodata)
        MBR_2.c (.text)
    } > Bt_Img_Info //(RX): ORIGIN = 0x1005FFD0, LENGTH = 0x0000002F


The S19 and elf read OK, when stepping through the code the code all works as expected, it runs from MRAM, loads the two MRAM variables and boots as expected. The assembly code loads the correct address...


Why would the code work 100% through the debugger and not without it? Its a little hard to debug because it works with the debugger! IS there something about the MRAM? Or is it something to do with how I have declared my variables?


In the project settings I have "initial launch" setup to download Exe, Const, Init (so it will program MRAM) and "Successive Runs" all unchecked. I figure if you have them all unchecked this will stop it sending any initialises data and simulate a hard boot?