mbed-os/targets/TARGET_TOSHIBA/TARGET_TMPM4G9
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
..
Periph_Driver Added new features to TMPM4G9 2019-07-03 17:10:29 +05:30
device Clean up ARM toolchain heap+stack setup in targets 2019-10-23 14:53:49 +03:00
PeripheralNames.h Added Support for TOSHIBA TMPM4G9 2018-10-15 10:20:21 +05:30
PinNames.h Added Support for TOSHIBA TMPM4G9 2018-10-15 10:20:21 +05:30
PortNames.h Added Support for TOSHIBA TMPM4G9 2018-10-15 10:20:21 +05:30
analogin_api.c Add HAL API for analog in pinmap 2019-02-08 09:09:51 -06:00
analogout_api.c Add HAL API for analog out pinmap 2019-02-08 09:10:05 -06:00
device.h Added new features to TMPM4G9 2019-07-03 17:10:29 +05:30
flash_api.c Support erase value in Flash HAL drivers, FlashIAP and block devices 2018-11-07 14:23:07 +02:00
gpio_api.c Fixed support for DigitalOut(NC) instantiation 2019-04-04 15:16:29 +05:30
gpio_irq_api.c Added new features to TMPM4G9 2019-07-03 17:10:29 +05:30
gpio_object.h Added Support for TOSHIBA TMPM4G9 2018-10-15 10:20:21 +05:30
i2c_api.c Added new features to TMPM4G9 2019-07-03 17:10:29 +05:30
objects.h Added new features to TMPM4G9 2019-07-03 17:10:29 +05:30
pinmap.c Added Support for TOSHIBA TMPM4G9 2018-10-15 10:20:21 +05:30
port_api.c Added Support for TOSHIBA TMPM4G9 2018-10-15 10:20:21 +05:30
pwmout_api.c Add HAL API for pwmout pinmap 2019-02-08 09:10:19 -06:00
reset_reason_api.c fix(hal-watchdog): Guard TMPM 'ResetReason' code behind feature flag 2019-05-24 12:23:43 +02:00
rtc_api.c Changes for RTC peripheral status 2019-07-03 17:57:49 +05:30
serial_api.c Added new features to TMPM4G9 2019-07-03 17:10:29 +05:30
sleep.c Added Support for TOSHIBA TMPM4G9 2018-10-15 10:20:21 +05:30
spi_api.c Added new features to TMPM4G9 2019-07-03 17:10:29 +05:30
us_ticker.c Implemented us_ticker free() & modified IAR stack 2018-10-15 10:20:22 +05:30