flash signature generation

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by jpplus on Thu May 21 01:55:35 MST 2015
Hi all,
I try to generate flash signature for LPC43XX, the problem I faced is I can get the correct signature (same with reference one which implement in Python and run in PC) when I generate signature for bank B.
my setting is:
1) my code is in bank A
2) main function and flash generation function are linked to RAM(verified by map file,    [color=#00c] flash_signature                          0x10000001   Thumb Code    70  main.o(ram_section)[/color])
3)If I put the address to Bank B, then I get correct data
4) if  I put addres to Bank A which hold same flash content, I get wrong signature
5) Keil ARM compiler and tick box "one ELF section per function"
6) I have to reset the flash controller, otherwise, I cannot ge correct signature from Bank B.

I think problem still rely on the code in BankA. I disable interrupt when running this code, but still get wrong.

void flash_signature ( uint32_t start, uint32_t stop, int index, uint32_t *sig)
    __attribute__((section ("ram_section")));
void flash_signature( uint32_t start, uint32_t stop, int index, uint32_t *sig )
LPC_FMC = (FLASHSIG_Type *)(LPC_FMCA_BASE);//if bank B, change to bank B address
LPC_FMC->FMSSTART = (start >> 4);
LPC_FMC->FMSTATCLR =  (1 << 2);


while((LPC_FMC->FMSTAT & (1 << 2)) == 0);

*(sig + 1) = LPC_FMC->FMSW1;
*(sig + 2) = LPC_FMC->FMSW2;
*(sig + 3) = LPC_FMC->FMSW3;
LPC_FMC->FMSTATCLR =  (1 << 2);