Move flash stubs to target directory and update readme.
This commit is contained in:
parent
b494279fe5
commit
f9bdaf06a4
|
@ -1,19 +0,0 @@
|
||||||
Flash Stubs
|
|
||||||
===========
|
|
||||||
|
|
||||||
For most of the targets, these are assembler routines for executing
|
|
||||||
a flash write on the supported targets. They are kept here for
|
|
||||||
reference, but are not used, as the compiled binary code is included
|
|
||||||
in the target drivers.
|
|
||||||
|
|
||||||
For the STM32l0x, the stubs are written in C++ and emitted as arrays
|
|
||||||
of half-words for inclusion in the target driver. The use of a higher
|
|
||||||
level language allows more detailed code and for easy revisions.
|
|
||||||
These stubs communicate with the driver through a structure defined in
|
|
||||||
the src/include/stm32l0-nvm.h header.
|
|
||||||
|
|
||||||
The dump-to-array.sh helper script uses sed to transform the output of
|
|
||||||
'objdump -d' into a half-word array of the instructions that may be
|
|
||||||
included in C code to declare the stub. FWIW, objcopy doesn't produce
|
|
||||||
the same output as objdump. It omits some of the instructions,
|
|
||||||
probably because the object file isn't linked.
|
|
|
@ -49,7 +49,7 @@ static int efm32_flash_write(struct target_flash *f,
|
||||||
uint32_t dest, const void *src, size_t len);
|
uint32_t dest, const void *src, size_t len);
|
||||||
|
|
||||||
static const uint16_t efm32_flash_write_stub[] = {
|
static const uint16_t efm32_flash_write_stub[] = {
|
||||||
#include "../flashstub/efm32.stub"
|
#include "flashstub/efm32.stub"
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool efm32_cmd_erase_all(target *t);
|
static bool efm32_cmd_erase_all(target *t);
|
||||||
|
|
|
@ -8,7 +8,7 @@ ifneq ($(V), 1)
|
||||||
Q = @
|
Q = @
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS=-Os -std=gnu99 -mcpu=cortex-m0 -mthumb -I../libopencm3/include
|
CFLAGS=-Os -std=gnu99 -mcpu=cortex-m0 -mthumb -I../../../libopencm3/include
|
||||||
ASFLAGS=-mcpu=cortex-m3 -mthumb
|
ASFLAGS=-mcpu=cortex-m3 -mthumb
|
||||||
|
|
||||||
all: lmi.stub stm32f4.stub stm32l4.stub nrf51.stub stm32f1.stub efm32.stub
|
all: lmi.stub stm32f4.stub stm32l4.stub nrf51.stub stm32f1.stub efm32.stub
|
|
@ -0,0 +1,13 @@
|
||||||
|
Flash Stubs
|
||||||
|
===========
|
||||||
|
|
||||||
|
These are simple routines for programming the flash on various Cortex-M
|
||||||
|
microcontrollers. The routines should be provided with the naked attribute
|
||||||
|
as the stack may not be available, and must not make any function calls.
|
||||||
|
The stub must call `stub_exit(code)` provided by `stub.h` to return control
|
||||||
|
to the debugger. Up to 4 word sized parameters may be taken.
|
||||||
|
|
||||||
|
These stubs are compiled instructions comma separated hex values in the
|
||||||
|
resulting `*.stub` files here, which may be included in the drivers for the
|
||||||
|
specific device. The drivers call these flash stubs on the target by calling
|
||||||
|
`cortexm_run_stub` defined in `cortexm.h`.
|
|
@ -54,7 +54,7 @@ static int lmi_flash_write(struct target_flash *f,
|
||||||
static const char lmi_driver_str[] = "TI Stellaris/Tiva";
|
static const char lmi_driver_str[] = "TI Stellaris/Tiva";
|
||||||
|
|
||||||
static const uint16_t lmi_flash_write_stub[] = {
|
static const uint16_t lmi_flash_write_stub[] = {
|
||||||
#include "../flashstub/lmi.stub"
|
#include "flashstub/lmi.stub"
|
||||||
};
|
};
|
||||||
|
|
||||||
static void lmi_add_flash(target *t, size_t length)
|
static void lmi_add_flash(target *t, size_t length)
|
||||||
|
|
|
@ -85,7 +85,7 @@ const struct command_s nrf51_read_cmd_list[] = {
|
||||||
#define STUB_BUFFER_BASE (SRAM_BASE + 0x28)
|
#define STUB_BUFFER_BASE (SRAM_BASE + 0x28)
|
||||||
|
|
||||||
static const uint16_t nrf51_flash_write_stub[] = {
|
static const uint16_t nrf51_flash_write_stub[] = {
|
||||||
#include "../flashstub/nrf51.stub"
|
#include "flashstub/nrf51.stub"
|
||||||
};
|
};
|
||||||
|
|
||||||
static void nrf51_add_flash(target *t,
|
static void nrf51_add_flash(target *t,
|
||||||
|
|
|
@ -89,7 +89,7 @@ static int stm32f1_flash_write(struct target_flash *f,
|
||||||
#define FLASHSIZE_F0 0x1FFFF7CC
|
#define FLASHSIZE_F0 0x1FFFF7CC
|
||||||
|
|
||||||
static const uint16_t stm32f1_flash_write_stub[] = {
|
static const uint16_t stm32f1_flash_write_stub[] = {
|
||||||
#include "../flashstub/stm32f1.stub"
|
#include "flashstub/stm32f1.stub"
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SRAM_BASE 0x20000000
|
#define SRAM_BASE 0x20000000
|
||||||
|
|
|
@ -104,7 +104,7 @@ static const char stm32f2_driver_str[] = "STM32F2xx";
|
||||||
|
|
||||||
/* This routine uses word access. Only usable on target voltage >2.7V */
|
/* This routine uses word access. Only usable on target voltage >2.7V */
|
||||||
static const uint16_t stm32f4_flash_write_stub[] = {
|
static const uint16_t stm32f4_flash_write_stub[] = {
|
||||||
#include "../flashstub/stm32f4.stub"
|
#include "flashstub/stm32f4.stub"
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SRAM_BASE 0x20000000
|
#define SRAM_BASE 0x20000000
|
||||||
|
|
|
@ -110,7 +110,7 @@ static const char stm32l4_driver_str[] = "STM32L4xx";
|
||||||
|
|
||||||
/* This routine is uses double word access.*/
|
/* This routine is uses double word access.*/
|
||||||
static const uint16_t stm32l4_flash_write_stub[] = {
|
static const uint16_t stm32l4_flash_write_stub[] = {
|
||||||
#include "../flashstub/stm32l4.stub"
|
#include "flashstub/stm32l4.stub"
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SRAM_BASE 0x20000000
|
#define SRAM_BASE 0x20000000
|
||||||
|
|
Loading…
Reference in New Issue