mbed-os/targets/TARGET_STM/TARGET_STM32F7
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
..
TARGET_STM32F746xG Clean up ARM toolchain heap+stack setup in targets 2019-10-23 14:53:49 +03:00
TARGET_STM32F756xG Clean up ARM toolchain heap+stack setup in targets 2019-10-23 14:53:49 +03:00
TARGET_STM32F767xI Clean up ARM toolchain heap+stack setup in targets 2019-10-23 14:53:49 +03:00
TARGET_STM32F769xI Clean up ARM toolchain heap+stack setup in targets 2019-10-23 14:53:49 +03:00
device TARGET_STM: I2C sequential communication revert PR #3324 to original cube HAL 2019-08-22 10:44:20 +02:00
analogin_device.c STM32 ADC INTERNAL CHANNEL reset after read 2019-03-29 14:30:49 +01:00
analogout_device.c Add HAL API for analog out pinmap 2019-02-08 09:10:05 -06:00
can_device.h Don't use define checks on DEVICE_FOO macros (partner code) 2018-12-20 20:02:29 +11:00
cmsis.h STM32: common cmsis.h and device.h 2019-05-27 16:27:41 +02:00
common_objects.h STM32L4: Add OSPI IP support in fallback QSPI mode 2019-08-23 15:18:48 +02:00
flash_api.c STM license file update 2019-09-10 14:24:48 +02:00
gpio_irq_device.c STM32: move pin_lines_desc to c file 2017-02-16 19:34:11 +01:00
gpio_irq_device.h STM32F2/F4/F7 : LL API is now available 2018-07-18 15:17:46 +02:00
i2c_device.h Don't use define checks on DEVICE_FOO macros (partner code) 2018-12-20 20:02:29 +11:00
pin_device.h STM32 GPIO : code cleaning 2018-11-08 17:26:17 +01:00
pwmout_device.c Don't use define checks on DEVICE_FOO macros (partner code) 2018-12-20 20:02:29 +11:00
pwmout_device.h __cplusplus guard fixed pwmout_device.h for STM32 families 2019-08-09 09:51:39 +02:00
serial_device.c Clearing UART TC Flag prevents deep sleep, so do not clear it 2019-10-15 15:59:51 +02:00
spi_api.c TARGET_STM32F7 astyle 2018-06-27 14:42:56 +02:00
spi_device.h STM32 SPI specific mode for higher performance 2017-06-16 10:23:48 +02:00