mbed-os/targets/TARGET_ARM_SSG/TARGET_CM3DS_MPS2
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
..
device Clean up ARM toolchain heap+stack setup in targets 2019-10-23 14:53:49 +03:00
PeripheralNames.h CM3DS: merge the two system header files into one 2018-04-20 16:40:27 +01:00
PinNames.h CM3DS: merge the two system header files into one 2018-04-20 16:40:27 +01:00
PortNames.h Update port api driver to add missing ports 2017-06-15 17:30:31 +01:00
README.md Copy edit README.md 2018-03-12 16:25:05 +00:00
analogin_api.c Add HAL API for analog in pinmap 2019-02-08 09:09:51 -06:00
cmsdk_ticker.c CM3DS: update tickers implementation 2018-02-21 18:12:55 +00:00
cmsdk_ticker.h CM3DS: merge the two system header files into one 2018-04-20 16:40:27 +01:00
device.h CM3DS: merge the two system header files into one 2018-04-20 16:40:27 +01:00
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 ARM SSG/FM: Cope correctly with NC GPIO 2019-05-02 12:16:34 +03:00
gpio_irq_api.c CM3DS: update GPIO, IRQ and port implementation 2018-02-21 18:17:55 +00:00
gpio_objects.h Merge branch 'master' of https://github.com/paul-szczepanek-arm/mbed-os 2018-02-27 17:23:25 +00:00
i2c_api.c HAL I2C: adds missing DEVICE_I2C guards 2019-06-19 23:08:55 +02:00
lp_ticker.c Implement LP and us tickers to CM3DS 2018-11-14 11:10:09 +01:00
mbed_overrides.c This commit adds EMAC driver for CM3DS that uses an SMSC LAN 9220 2018-10-29 15:30:47 +01:00
objects.h Flash API: Enable Flash api on CM3DS 2018-07-09 21:07:48 +08:00
pinmap.c Merge branch 'master' of https://github.com/paul-szczepanek-arm/mbed-os 2018-02-27 17:23:25 +00:00
port_api.c CM3DS: fix compiler warnings 2018-04-20 16:52:19 +01:00
rtc_api.c Add RTC and Sleep to CM3DS 2018-11-14 11:10:26 +01:00
serial_api.c Add HAL API for serial pinmap 2019-02-08 09:10:28 -06:00
sleep_api.c Merge branch 'master' into cm3ds_lp_requirements 2018-11-20 19:54:33 +01:00
spi_api.c Add HAL API for spi pinmap 2019-02-08 09:10:37 -06:00
trng_api.c CM3DS: merge the two system header files into one 2018-04-20 16:40:27 +01:00
us_ticker.c Implement LP and us tickers to CM3DS 2018-11-14 11:10:09 +01:00

README.md

Cortex-M3 Design Start Eval package example on MPS2+ board

This folder includes the port of Mbed OS on the example system of the Cortex-M3 Design Start Eval package. This example is implemented in FPGA on the MPS2+ board. Please see this target's Mbed page for more information. For convenience, this target is called CM3DS.

Compiling

The target name is ARM_CM3DS_MPS2. You can compile Mbed OS projects for CM3DS with:

mbed compile -t COMPILER -m ARM_CM3DS_MPS2

Mbed OS supports the following compilers (replace COMPILER with):

  • ARM for Arm Compiler version 5.
  • GCC_ARM for GNU Compiler for Arm.
  • IAR for IAR compiler.

Running

Because of the new memory configuration introduced in commit CM3DS: switch to larger memories for code and data, it has become easier (and portable among all compilers) to use .elf files instead of .bin. .elf files are now the default for CM3DS projects, and compilation generates only them. For .elf files to work, you need at least version 2.2.5 of the MPS2+ firmware. For more information, please see the firmware version 2.2.6 and instructions on how to put it in the MPS2+ board.

Testing

If you want to execute the Mbed OS greentea tests on CM3DS, you need at least firmware version 2.2.6.

  • mbedls does not automatically recognize which serial port is linked to the board. Check it manually, and create a file named mbedls.json containing (at the same level than where you execute all commands):
{
    "50040200074D652F3828F333": {
        "serial_port": "/dev/ttyUSB0"
    }
}

Replace /dev/ttyUSB0 with your correct serial port (something like COM6 on Windows).

  • mbedls does not link CM3DS target ID with its name, so execute the command:
mbedls --mock 5004:ARM_CM3DS_MPS2
  • You can now compile and run the tests:
mbed test -m ARM_CM3DS_MPS2 -t COMPILER