mbed-os/targets/TARGET_NORDIC/TARGET_MCU_NRF51822
Kevin Bracey fb6aa3ef4f Clean up ARM toolchain heap+stack setup in targets
ARM Compiler 6.13 testing revealed linker errors pointing out
conflicting use of `__user_setup_stackheap` and
`__user_initial_stackheap` in some targets. Remove the unwanted
`__user_initial_stackheap` from the targets - the setup is
centralised in the common platform code.

Looking into this, a number of other issues were highlighted

* Almost all targets had `__initial_sp` hardcoded in assembler,
  rather than getting it from the scatter file. This was behind
  issue #11313. Fix this generally.
* A few targets' `__initial_sp` values did not match the scatter
  file layout, in some cases meaning they were overlapping heap
  space. They now all use the area reserved in the scatter file.
  If any problems are seen, then there is an error in the
  scatter file.
* A number of targets were reserving unneeded space for heap and
  stack in their startup assembler, on top of the space reserved in
  the scatter file, so wasting a few K. A couple were using that
  space for the stack, rather than the space in the scatter file.

To clarify expected behaviour:

* Each scatter file contains empty regions `ARM_LIB_HEAP` and
  `ARM_LIB_STACK` to reserve space. `ARM_LIB_STACK` is sized
  by the macro `MBED_BOOT_STACK_SIZE`, which is set by the tools.
  `ARM_LIB_HEAP` is generally the space left over after static
  RAM and stack.
* The address of the end of `ARM_LIB_STACK` is written into the
  vector table and on reset the CPU sets MSP to that address.
* The common platform code in Mbed OS provides `__user_setup_stackheap`
  for the ARM library. The ARM library calls this during startup, and
  it calls `__mbed_user_setup_stackheap`.
* The default weak definition of `__mbed_user_setup_stackheap` does not
  modify SP, so we remain on the boot stack, and the heap is set to
  the region described by `ARM_LIB_HEAP`. If `ARM_LIB_HEAP` doesn't
  exist, then the heap is the space from the end of the used data in
  `RW_IRAM1` to the start of `ARM_LIB_STACK`.
* Targets can override `__mbed_user_setup_stackheap` if they want.
  Currently only Renesas (ARMv7-A class) devices do.
* If microlib is in use, then it doesn't call `__user_setup_stackheap`.
  Instead it just finds and uses `ARM_LIB_STACK` and `ARM_LIB_HEAP`
  itself.
2019-10-23 14:53:49 +03:00
..
Lib restructure - Moved targets out to top level 2016-09-30 19:18:09 -05:00
TARGET_ARCH_BLE restructure - Moved targets out to top level 2016-09-30 19:18:09 -05:00
TARGET_DELTA_DFCM_NNN40 Ensured all NORDIC platforms define P0_{0..30} to match existing p{0..30} in PinNames.h 2016-11-01 08:57:38 +00:00
TARGET_HRM1017 restructure - Moved targets out to top level 2016-09-30 19:18:09 -05:00
TARGET_MTM_MTCONNECT04S restructure - Moved targets out to top level 2016-09-30 19:18:09 -05:00
TARGET_NRF51_DK restructure - Moved targets out to top level 2016-09-30 19:18:09 -05:00
TARGET_NRF51_DONGLE Ensured all NORDIC platforms define P0_{0..30} to match existing p{0..30} in PinNames.h 2016-11-01 08:57:38 +00:00
TARGET_NRF51_MICROBIT Modified micro:bit pin names to mirror micro:bit edge connector 2016-11-01 09:20:24 +00:00
TARGET_NRF51822_MKIT restructure - Moved targets out to top level 2016-09-30 19:18:09 -05:00
TARGET_NRF51822_SBKIT restructure - Moved targets out to top level 2016-09-30 19:18:09 -05:00
TARGET_NRF51822_Y5_MBUG restructure - Moved targets out to top level 2016-09-30 19:18:09 -05:00
TARGET_RBLAB_BLENANO restructure - Moved targets out to top level 2016-09-30 19:18:09 -05:00
TARGET_RBLAB_NRF51822 restructure - Moved targets out to top level 2016-09-30 19:18:09 -05:00
TARGET_SEEED_TINY_BLE restructure - Moved targets out to top level 2016-09-30 19:18:09 -05:00
TARGET_TY51822R3 restructure - Moved targets out to top level 2016-09-30 19:18:09 -05:00
TARGET_VBLUNO51 Add support for VBLUno51 board [TARGET_VBLUNO51] 2017-06-25 20:16:58 +07:00
TARGET_WALLBOT_BLE restructure - Moved targets out to top level 2016-09-30 19:18:09 -05:00
device Clean up ARM toolchain heap+stack setup in targets 2019-10-23 14:53:49 +03:00
PeripheralNames.h restructure - Moved targets out to top level 2016-09-30 19:18:09 -05:00
PortNames.h restructure - Moved targets out to top level 2016-09-30 19:18:09 -05:00
analogin_api.c Add HAL API for analog in pinmap 2019-02-08 09:09:51 -06:00
gpio_api.c restructure - Moved targets out to top level 2016-09-30 19:18:09 -05:00
gpio_irq_api.c restructure - Moved targets out to top level 2016-09-30 19:18:09 -05:00
gpio_object.h restructure - Moved targets out to top level 2016-09-30 19:18:09 -05:00
i2c_api.c HAL I2C: adds missing DEVICE_I2C guards 2019-06-19 23:08:55 +02:00
objects.h restructure - Moved targets out to top level 2016-09-30 19:18:09 -05:00
pinmap.c restructure - Moved targets out to top level 2016-09-30 19:18:09 -05:00
port_api.c restructure - Moved targets out to top level 2016-09-30 19:18:09 -05:00
pwmout_api.c Add HAL API for pwmout pinmap 2019-02-08 09:10:19 -06:00
serial_api.c Add testing pinmaps to NRF5X devices 2019-02-08 09:10:46 -06:00
sleep.c Renamed files in platform to match source names 2017-02-22 18:17:54 -06:00
spi_api.c Add testing pinmaps to NRF5X devices 2019-02-08 09:10:46 -06:00
twi_config.h restructure - Moved targets out to top level 2016-09-30 19:18:09 -05:00
twi_master.c restructure - Moved targets out to top level 2016-09-30 19:18:09 -05:00
twi_master.h restructure - Moved targets out to top level 2016-09-30 19:18:09 -05:00
us_ticker.c Add lp/us ticker_free() functions stub. 2018-07-25 08:58:38 +02:00