First of all, thanks for everyone helping me to solve this issue! :-)

Igor:
I am sorry! Now I found the text about memory map after a reset. The problem regarding the first 64 bytes was solved.
Now I just need to know how to disable this memory map...
About calc_checksum, I am already using it:

flash bank lpc2000 0x0 0x80000 0 0 0 lpc2000_v2 12000 calc_checksum

Nico:
lpc21isp will be a very useful tool! I will try it. thank you very much!

I still need OpenOCD to debug software using GDB.
When the gdb succesfully write to the flash memory, the program starts and reaches a breakpoint in main. When it fails, the breakpoint is never reached. When I stop gdb, pc is in 0xc address (undefined instruction vector).
After gdb write to memory, I run the command:

monitor mdw 0 0x20

sometimes it shows the same initial 64 bytes (now I know that this is the mapped memory) and sometimes the correct data.
Why sometimes it works and sometimes it do not?
How can I disable this memory to be mapped?
I will search for this, any news I will send to the list!

Thank you very much again!

Best regards,
Marcelo Utikawa da Fonseca

Igor Skochinsky escreveu:
Marcelo,

The current lpc2000.c mentions this:

/*
* flash bank lpc2000 <base> <size> 0 0 <target#> <lpc_variant> <cclk>
[calc_checksum]
*/

Have you tried adding "calc_checksum"?

On Wed, Dec 16, 2009 at 16:13, Nico Coesel <ncoe...@dealogic.nl> wrote:
  
-----Original Message-----
From: openocd-development-boun...@lists.berlios.de [mailto:openocd-
development-boun...@lists.berlios.de] On Behalf Of Igor Skochinsky
Sent: woensdag 16 december 2009 16:01
To: Marcelo Utikawa da Fonseca
Cc: openocd-development@lists.berlios.de
Subject: Re: [Openocd-development] Problem when tryng to flash LPC2368

Hello Marcelo,

What you see is bootrom code that gets automatically mapped to 0 if
there is no user code or it's invalid.

"The interrupt vectors residing in the boot block of the on-chip flash
memory also become active after reset, i.e., the bottom 64 bytes of
the boot block are also visible in the memory region starting from the
address 0x0000 0000. The reset vector contains a jump instruction to
the entry point of the flash boot loader software."

00000000                 LDR     R4, =0x3FFF8000
00000004                 LDR     R5, =0xFFFFBFFF
00000008                 LDR     R6, [R4]
0000000C                 AND     R6, R5, R6
00000010                 STR     R6, [R4]
00000014                 LDR     PC, =0x7FFFE040

0x7FFFE040 is the bootrom entrypoint.

"3.1.1 Criterion for Valid User Code
Criterion for valid user code: The reserved ARM interrupt vector
location (0x0000 0014) should contain the 2's complement of the
check-sum of the remaining interrupt vectors. This causes the checksum
of all of the vectors together to be 0. The boot loader code disables
the overlaying of the interrupt vectors from the boot block, then
checksums the interrupt vectors in sector 0 of the flash. If the
signatures match then the execution control is transferred to the user
code by loading the program counter with 0x0000 0000. Hence the user
flash reset vector should contain a jump instruction to the entry
point of the user application code."

My guess is that FlashMagic automatically patches the checksum to be
correct.
      
IIRC OpenOCD should do this or has this function been deleted? I recall
some discussion about that but I don't remember the outcome. I can't
imagine OpenOCD doesn't calculate the checksum. All compiler / linker
tools more or less assume the programming software takes care of
creating the checksum.

Nico Coesel

_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

    



  
---------------------------------------------
Tecnequip Tecnologia em Equipamentos
Endereço/Address: R. Ganges, 557
Cidade/City: São Paulo
Estado/State: SP
País/Country: Brasil
CEP/Postal Code: 03445-030
Fone/Phone: 55-11-20937199
FAX: 55-11-29412289
_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to