Content originally posted in LPCWare by mostafanfs on Thu Apr 07 00:30:46 MST 2016
Quote: robert hulsebos
Interrupt vectors are at address 0 after startup and remain there unless you relocate them (VTOR register).
Anyway, best approach is to make sure interrupts are disabled during your IAP calls, because if I remember correctly the ROM API makes some temporary changes to the memory map while it is active. Our experience is that an interrupt while processor is busy in IAP may cause the processor to crash. At least it is with LPC1769. I am not sure if the same applies for LPC1778...
Yeah I mentioned I have disabled all interrupts using __disable_irq() and I don't need any interrupts for that matter.
The thing is with the sector #1 that whenever I try to erase it it just blows.
I checked and VTOR register has been assigned with 0x00001000 (so I guess it's sector #1) . Could that be the reason?
If that is the case then where would I put it?
It has been done in system_LPC177x_8x.c file which has came from NXP samples I guess. So I figured it was ok.
Also another question. What data are located in sector #0 ?
I took this board from a company and apparently there is a .bin file which is supposed to be programmed at 0x00000000 address or it wouldn't work. Unfortunately it's a .bin file and I can't make much sense out of it obviously. I just know I;m supposed to program it there at address 0x00000000 with jFlash utility. As you see I got the linker file (.icf in first post) from this company and they have remarked 0x00001000 address (sector #1) as you see in following symbol :
define symbol __ICFEDIT_region_UPDATE_IMAGE_ROM_start__ = 0x00001000;
But then there is another symbol marking the location of interrupt vectors (.intvec section)
define symbol __ICFEDIT_intvec_start__ = 0x00001000;
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
So it's the same as ROM_Start address and both are sector #1 (0x00001000)
So what is this .bin file located in 0x00000000 address (sector #0) doing here ? is it some sort of jumping to sector #1 in there?
Why couldn't I put my application in sector #1 without programming anything in sector #0 ?
I mean what is the execution sequence in the processor? If there is nothing in sector #0 shouldn't it be able to jump to sector #1 where there is a valid program waiting for execution ?
Could I just simply assign 0x00000000 to VTOR and put .intvec section and ROM_start at 0x00000000 (in linker file) and not program that crazy .bin file in sector #0 anymore? I think it should work even though I don't have access to my board right now.
Sorry for asking too much. I'm just confused.