LED selector

Post details of your projects here.
YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

Re: LED selector

Post by YahooArchive »

The Flash in the LPC17xx can only be erased a sector at a time, and a sector is
4K or 32K. Erasing sets the data in the sector to 0xFF, all 1s. You can then
write a block changing 1s to 0s 256 bytes at a time. You can't change a 0 back
into a 1 without erasing the sector.

Details in the NXP user manual.



YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

Re: LED selector

Post by YahooArchive »

I have been trying to program a 4K array in RAM, but I gat a Memory error if I
set the array to more than 1K. I thought there was 8K of RAM. Other than that
array, my program doesn't use much memory.

YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

Re: LED selector

Post by YahooArchive »

A 1K array of integers is 4K bytes

Yes there is 8K in the ARMmite, but take away 512 bytes for IAP calls (like
writing to Flash), 256 bytes for the string accumulator, 256 for UART buffer, 1K
for stack, and that leaves about 6K for user variables.

If you have a 4K Flash block not used for program or constant strings, then you
could use that to save configuration variables. So your program would need to
be less than 12K, the last 4K is used for constant strings.

YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

Re: LED selector

Post by YahooArchive »

I couldn't find breakpoint.h, but I did insert the following code in my source
file.


unsigned int save4dump;

void dumpmem(char *line) {
unsigned int i,j;

i=1; j=0;
if (line[1] == 0) {
j = save4dump+32;
} else {
while (line>' ') {
j = (j<<4) + hexdigit(line[i++]);
}
j=j & 0xfffffffc; // word allign
}
j = j>0x4000 ? j : 0x4000; // protect low code from prying eyes
for (i=0; i<8; i++) {
printhex(*(int *)(j+(i<<2)));
}
save4dump = j;
uart0Putch('\n');
}

void breakpoint(void) {
char line[80];

while (1) {
getline(line, 80);
if( line[0] == '@') { // dump location
dumpmem(line);
}
else if( line[0] == '^') break; // restart
}
};

Then I called breakpoint(); at the end of my While loop. I verified that the
program does stop at that point, but I can't find the Memory Dump output file.

Where does the output go?

YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

Re: LED selector

Post by YahooArchive »

I highly recommend you install the latest CMSIS version of the C utilities,
going forward it's what we use and know best. Anything else would be a mixture
of old and new, and who knows...

As in Csample.c and sample.c both #include "breakpoint.h" which is in the
/Program Files (x86)/Coridium/CMSIS/include directory.

MakeItC is normally setup to look for include files there as well, and if it
finds the corresponding .c source it will compile that, or if it finds a .o
object file it will try to link with that.

breakpoint uses printf.h and uart.h and it sends/receives from UART0.

Post Reply