Hi,
I'm using 'NXP LPC17xx USB Secondary Bootloader'.
I read the whole "AN10866.pdf" which commes together with the code on this link: ics.nxp.com/.../an10866.zip
I did everything as described in document and basically it works fine. I can program my chip using this USB bootloader.
So where is the problem? When I use more than 1572 bytes for global variables in my application then the program will not run normally. It halts. If I try then to program the chip over the JTAG with the same code (only I change the starting position from 0x2000->0x0000), then it runs normally.
Does anyone of you know the where could be the problem ? Any hint what to change to make it work regardless to the number of global variables ?
Working code:
int dummy2; int *dummy3; char Dummy_check[500];
#include <LPC17xx.h> #include "system_LPC17xx.c"
int main () { // Init clock 96Mhz, 12 Mhz crystal SystemInit(); SystemCoreClockUpdate();
//Init output pin for blinking led LPC_PINCON->PINSEL7&=~(3<<18); LPC_GPIO3->FIODIR=1<<25;
while(1) { for (long i=0;i<2500000;i++); //delay for a fraction of a second LPC_GPIO3->FIOSET=1<<25; //LED ON for (long i=0;i<2500000;i++); //delay for a fraction of a second LPC_GPIO3->FIOCLR=1<<25; //LED OFF }; }
Not working code:
//int dummy2; int *dummy3; char Dummy_check[500];
If I comment the dummy3, the code also don't work. I can change the size of a field Dummy_check.
In this case the problem occurs when removing a variable. Sometimes the problem occurs then adding them.
Any ideas?
Might you have an issue with how you align the stack?
By the way - it does not hurt if you look up the posting instructions for source code. It's described directly above the input message box.
It is probably something with stack. I have set on both: bootloader, and user aplication the adress for memory: 0x10000000, and size 0x8000.
It was like that by default.
If I select IRAM2 with a start at 0x2007C000 for user application, then it works normally. I know that IRAM2 is divided into two sections, so I rather would not use this area.
My apologizes for the unformated source code. My first post here, lesson learned.