Commit Graph

62 Commits (8a4bba33bd0706754312b8ff2e0dfed1aabd9fcb)

Author SHA1 Message Date
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
Mahesh Mahadevan e65012e549 MCUXpresso: Update the Kinetis Serial driver for MBED_TICKLESS
We should not block in case the UART is busy transmitting. The
API has been updated to check the status of all UART's and return
1 in case any of them is busy transmitting.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2019-09-05 13:58:59 -05:00
Mahesh Mahadevan 5af80db8b6 MCUXpresso Kinetis SPI drive: Add a delay between CS assertion and first sclk edge
1. FPGA test shield requires at least half sclk period delay between
CS assertion and first sclk edge
2. Update Kinetis SPI drivers to match what is already done for K64F

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2019-08-23 07:11:43 -05:00
Mahesh Mahadevan a85f0824be MCUXpresso: Update EDMA drivers to fix warnings
Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2019-08-22 10:47:43 -05:00
Mahesh Mahadevan a184a86e90 MCUXpresso: Update the SDK LPUART drivers
Use the latest driver from K66F

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2019-08-22 08:26:11 -05:00
Mahesh Mahadevan bff287580c MCUXpresso: Update I2C SDK driver
Use the K66F driver that has the latest

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2019-08-22 07:48:29 -05:00
Mahesh Mahadevan 23bf7b74b0 MCUXpresso: Update SDK EDMA driver
Update to the latest version from K66F

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2019-08-22 07:48:29 -05:00
Mahesh Mahadevan 382696fc50 MCUXpresso: Use SDK API for spi_master_block_write
Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2019-08-22 07:48:28 -05:00
Mahesh Mahadevan 4102114a72 MCUXpresso: Update Kinetis DSPI SDK drivers
- Added dummy data setup API to allow users to configure
  the dummy data to be transferred.
- Added new APIs for half-duplex transfer function. Users
  can send and receive data by one API in the polling/interrupt/EDMA way,
  and they can choose either to transmit first or to receive first.
  Additionally, the PCS pin can be configured as assert status in
  transmission (between transmit and receive) by setting the
  isPcsAssertInTransfer to true.
- Fix for MISRA issues

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2019-08-22 07:48:28 -05:00
Mahesh Mahadevan eaace297dc MCUXpresso: Provide an API to wait till TX complete
Wait till the data is flushed out of TX buffer

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2019-08-12 10:57:04 -05:00
Mahesh Mahadevan 75608f6db2 MCUXpresso: Updated SMC SDK driver
Update includes allocating RAM region for code to enter
stop modes and execute this code in RAM, thus the flash
is idle and no prefetch is performed while entering stop
mode.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2019-08-12 10:56:56 -05:00
Martin Kojtal 8b49ffc0c3
Merge pull request #10920 from NXPmicro/Update_Kinetis_SDK_Clock_Driver
Kinetis MCUXpresso: Update the clock drivers
2019-07-02 12:44:09 +01:00
Mahesh Mahadevan 6c674ec0c7 Kinetis MCUXpresso: Update the clock drivers
Updated driver includes
1. Bug fixes
2. Formatting updates.
3. Fix for warnings
4. Better code commenting

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2019-06-28 10:09:52 -05:00
Martin Kojtal 85c477c1dc
Merge pull request #10609 from kjbracey-arm/us_ticker_optimise
wait_us optimization
2019-06-28 14:29:00 +01:00
Kevin Bracey e5e2e0ac22 Freescale MCUXpresso: optimize us_ticker
Provide new optimizations for us_ticker and wait_us.
2019-06-14 10:22:08 +03:00
Filip Jagodzinski 5f95c5fc85 KL82Z: Fix serial IRQ handling
Check that the RX or TX interrupt is enabled before calling
a registered handler with RxIrq or TxIrq arg.
2019-06-07 16:37:49 +02:00
deepikabhavnani c5ad5f6c94 Target_Freescale:Add heap section 2019-02-19 15:49:49 -06:00
deepikabhavnani f518a696de Remove unused heap_size define 2019-02-19 15:49:49 -06:00
Deepika e03455a920 Target_Freescale: Set the heap size and limit 2019-02-19 15:49:49 -06:00
Russ Butler 8669417e7b Add HAL API for spi pinmap
Add the functions to get spi pinmaps to all targets.
2019-02-08 09:10:37 -06:00
Russ Butler 34c176654d Add HAL API for serial pinmap
Add the functions serial_tx_pinmap, serial_rx_pinmap, serial_cts_pinmap
and serial_rts_pinmap to all targets.
2019-02-08 09:10:28 -06:00
Russ Butler be492fe07a Add HAL API for pwmout pinmap
Add the function pwm_pinmap to all targets.
2019-02-08 09:10:19 -06:00
Russ Butler 82b131aa59 Use dedicated PinMap for each QSPI data line
Split PinMap_QSPI_DATA into PinMap_QSPI_DATA0 - PinMap_QSPI_DATA3.
This allows pins to be selected more accurately.
2019-01-22 12:11:15 -06:00
Przemyslaw Stekiel 08004e141d [Freescale] Support boot stack size configuration option 2019-01-08 15:32:03 +01:00
Mahesh Mahadevan dcc8b659bc MCUXpresso: Ensure the RTC OSC is running at bootup on Kinetis platforms
This is a fix for Issue 5348.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2018-11-28 10:31:58 -06:00
Cruz Monrreal II a5bef60afe Revert "Merge pull request #8272 from NXPmicro/Ensure_RTC_OSC_Start"
This reverts commit 3d859ca1d6, reversing
changes made to 03f4623b80.
2018-11-20 16:58:11 -06:00
Cruz Monrreal 0db896036c
Merge pull request #8485 from NXPmicro/feature-qspi-kinetis
Feature qspi kinetis
2018-10-23 12:38:11 -05:00
Mahesh Mahadevan 9dc3f8c19a KL82Z FRDM: Update the KL82Z Freedom board for QSPI
Add the QSPI pin defines, clock information and flash details

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2018-10-18 12:14:27 -05:00
Mahesh Mahadevan 9f64e46de2 K82F, KL82Z: Update register access mode for QSPI IPCR register
Add 16-bit access mode when writing the transfer size to prevent
the QSPI transaction from starting

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2018-10-18 12:14:26 -05:00
Mahesh Mahadevan 3bd6235032 K82F, KL82Z: Update the QSPI SDK driver to the latest version
Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2018-10-18 12:14:25 -05:00
Mahesh Mahadevan ebf31c67f0 MCUXpresso: Ensure the RTC OSC is running at bootup on Kinetis platforms
This is a fix for Issue 5348.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2018-10-18 08:55:48 -05:00
Deepika 525545c7b0 Freescale: Fix alignment of execute region to 8-byte boundary
--legacyalign, --no_legacyalign are deprecated from ARMC6 compiler, in order to
remove deprecated flags all linker files (GCC and IAR as well to have uniformity)
should strictly align to 8-byte boundary
2018-09-19 09:35:59 -05:00
Oren Cohen 787317b7eb Remove uVisor from mbed-os 2018-08-22 16:36:59 +03:00
Przemyslaw Stekiel c0ee843d63 Add lp/us ticker_free() functions stub.
This patch adds only empty stubs of `us_ticker_free()` and `lp_ticker_free()` for all boards where these functions are not implemented.
2018-07-25 08:58:38 +02:00
David Saada 714d025f6c Rename text region in ARM linker file for a few NXP CPUs 2018-06-18 17:32:01 +03:00
Bartek Szatkowski a305d849a8 Rename LOWPOWERTIMER to LPTICKER 2018-05-25 13:06:56 -05:00
Russ Butler a0a9626420 Keep rtc code if low power timer is used
Keep the RTC code if either DEVICE_RTC or DEVICE_LOWPOWERTIMER is
defined on the devices which use the RTC for both the rtc api and the
low power timer api. This allows DEVICE_LOWPOWERTIMER to be enabled while
DEVICE_RTC is turned off.
2018-05-25 12:37:19 -05:00
Mahesh Mahadevan 4eb8841dc1 MCUXpresso: Update the usticker implementation
Enabled usticker for K22F, K24F, K66F, K82F, KL82Z, KW24D

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2018-05-25 12:32:38 -05:00
Mahesh Mahadevan 0fb2f01ce7 KL82Z: Fix clock selection for PWMOUT driver
This was verified using the ci-test shield

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2018-05-01 12:22:04 -05:00
Mahesh Mahadevan e163a2769f MCUXpresso: Update Kinetis flash driver
Flash functions needed to be called before entering deepsleep mode

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2018-04-10 08:16:41 -05:00
Mahesh Mahadevan c3f8cac2e3 KL82Z: Fix the clock selection for LPUART module
Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2018-03-27 02:52:20 -05:00
Mahesh Mahadevan 7ed36e4986 MCUXpresso_MCUS: Apply K64F us_ticker fix across all MCU's
Applied changes from commit b6a01de070
for other MCUXpresso MCUs

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2018-03-07 07:27:04 -06:00
Mahadevan Mahesh 168bdc8803 MCUXpresso: Fix issue of ticker interrupt incorrectly firing
Fix for Issue #5279

Signed-off-by: Mahadevan Mahesh <Mahesh.Mahadevan@nxp.com>
2017-10-18 15:29:57 +01:00
Jimmy Brisson cd4fd86f1f Correct Freescale + NXP compiler detection macros
Also removes duplication of common files
2017-09-11 13:20:32 -05:00
Jimmy Brisson 15a9a0382b Enable Compiling with ARMC6 across all targets
remove duplicate sys.cpp
2017-09-11 13:20:32 -05:00
Russ Butler b402b7a8c6 Fix crash on boot due to vector size mismatch
If NVIC_NUM_VECTORS is larger than the space allocated by the vector
table in ram (__ram_vector_table_size__) then the call to mbed_cpy_nvic
during boot will corrupt valid data, which can lead to a crash. This
patch fixes the declared number of vectors on the KL27Z, KL43Z and
KL82Z to fix this crash.
2017-09-01 18:43:38 -05:00
Jimmy Brisson 1f94ede86c Merge pull request #4744 from deepikabhavnani/spi_issue_4743
Allow user to set default transfer byte for block read
2017-07-24 14:45:30 -05:00
Deepika 1b797e9081 Closed review comments
1. Doxygen and Grammar related
2. Change dummy to spi_fill
3. Remove NXP driver and add default loop in spi block read (same as all
other drivers)
2017-07-21 09:46:22 -05:00
Martin Kojtal 10ea63b8e7 Ticker: add fire interrupt now function
fire_interrupt function should be used for events in the past. As we have now
64bit timestamp, we can figure out what is in the past, and ask a target to invoke
an interrupt immediately. The previous attemps in the target HAL tickers were not ideal, as it can wrap around easily (16 or 32 bit counters). This new
functionality should solve this problem.

set_interrupt for tickers in HAL code should not handle anything but the next match interrupt. If it was in the past is handled by the upper layer.

It is possible that we are setting next event to the close future, so once it is set it is already in the past. Therefore we add a check after set interrupt to verify it is in future.
If it is not, we fire interrupt immediately. This results in
two events - first one immediate, correct one. The second one might be scheduled in far future (almost entire ticker range),
that should be discarded.

The specification for the fire_interrupts are:
- should set pending bit for the ticker interrupt (as soon as possible),
the event we are scheduling is already in the past, and we do not want to skip
any events
- no arguments are provided, neither return value, not needed
- ticker should be initialized prior calling this function (no need to check if it is already initialized)

All our targets provide this new functionality, removing old misleading if (timestamp is in the past) checks.
2017-07-13 12:23:25 +01:00
Jimmy Brisson c7d6bbe295 Upcase all assembler file extensions 2017-06-20 14:50:08 -05:00