First of all, thank you for the quick response.
Let's use as an example the programming that we perform in the microcontroller of Atmel, the SAM4E.
We use the following SAM4E document as a reference:
http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-11157-32-bit-Cortex-M4-Microcontroller-SAM4E16...
We use the following document (chapter "Debug Access Port") as a reference for SWD (ARM):
http://infocenter.arm.com/help/topic/com.arm.doc.ddi0314h/DDI0314H_coresight_components_trm.pdf
Following is the process that we followed to erase the SAM4E memory:
- We write the value 0x400E0A04 (address of the SAM4E register that has the bit that enables Erase all) in the SWD TAR register.
- Then we write in SWD DRW register the value 0x5A000005 (value to enable Erase all)
Following is the procedure we followed to perform memory programming:
- We write in the TAR register of SWD the value of the Flash address where we want to save the data. In this case, the starting address is 0x00400000.
- Then we write in SWD register DRW the value of the data contained in the .hex.
- After writing the address and the data of 512 bytes, we send the command to programming, as described below:
- Write the value 0x400E0A04 (address of the SAM4E register that has the bit that enables writing to the SAM4E flash memory) in the SWD TAR register.
- Then we write in SWD DRW register the value 0x5A000001 (value to enable write to flash memory of SAM4E)
- In this way, we continue until the end of the .hex.
We also perform the programming of SAMD10, SAMD20 and STM32F107 ARMs.
We need an LPC1769 document that explains how we can manipulate its flash memory by showing us the addresses of the registers and the values that these registers must take so that we can access the address of these registers through the TAR and write or read the data, using the DRW register.