Commit Graph

1250 Commits (9ac7fe7ac92dadff06951abb9356a8d47d430231)

Author SHA1 Message Date
Kevin Bracey 66f446b9a9 Add GPIO NC test
Check two items of defined behaviour - that you can initialise a
gpio_t with NC, and you can detect that state with gpio_is_connected().
2019-05-02 16:12:21 +03:00
Kevin Bracey ad1acf9af7 gpio_api.h: Clarify desired behaviour for NC
It would probably be worth adding tests for the ability to initialise NC
pins and check `is_connected`. Some platforms are assert failing the
init, and can't be 100% sure `is_connected` is working on those
platforms either.
2019-05-02 12:16:34 +03:00
Cruz Monrreal ab22ab8ce3
Merge pull request #10150 from kjbracey-arm/timer_sleepcheck
Timer: remove hard-coded lp_ticker knowledge
2019-03-28 17:09:36 -05:00
Michael Schwarcz 568feaf7da Remove dependency on us_ticker HAL apis for non USTICKER targets
- Surround mbed_us_ticker_api.c with if DEVICE_USTICKER
- get_us_ticker_data() returns NULL for non-usticker targets.
2019-03-26 09:52:17 +02:00
Kevin Bracey 534a3d2333 Timer: remove hard-coded lp_ticker knowledge
The knowledge that lp_ticker runs in deep sleep was hard-coded with a
comparison check of a ticker_data_t pointer against get_lp_ticker_data.

Remove this hard-coded check, which adds a linker dependency against
the low power ticker even if not being used - put a flag into the
ticker_interface_t.

A future extension might be to move this flag into the ticker_info_t
provided by the HAL, but for the moment keep the assumption that
lp_ticker does run, us_ticker doesn't.
2019-03-20 10:18:49 +02:00
Kevin Bracey b12be6bb80 Rename SPI_COUNT to DEVICE_SPI_COUNT
Avoid collision with some HALs that already define SPI_COUNT.
2019-03-01 14:37:04 +02:00
Kevin Bracey df7e3367f7 Cope with HALs not defining SPIName 2019-03-01 14:33:34 +02:00
Kevin Bracey 5e059b7d1d SPI upgrade - per-peripheral mutex and GPIO-based SSEL
This commit takes some of the work done on the SPI class from #8445, and
refines it, to provide the per-peripheral mutex functionality.

This also implements GPIO-based SSEL, which exposes a new
select()/deselect() API for users to group transfers, and should work on
every platform (unlike the HAL-based SSEL). This requires users to use a
new constructor to avoid backwards compatibility issues.

To activate the per-peripheral mutex, the HAL must define SPI_COUNT and
provide spi_get_peripheral_name().  (In #8445 this is a reworked
spi_get_module, but the name is changed here to avoid a collision with
existing HALs - this commit is designed to work without wider HAL
changes).

Fixes: #9149
2019-03-01 14:33:33 +02:00
Russ Butler 7071513d7f Add form factor pinmap support
Add support for listing all the pins of one or more form factors.
This is in preparation for automated testing of the default form
factor.

This patch includes the following:
-A function to get a list of restricted pins which should not be
    used for testing due to some caveat.
-The target config "default-form-factor" which can specify which form
    factor should be tested
-Form factor information for the arduino form factor
2019-02-08 09:10:45 -06:00
Russ Butler 0dee05a843 Add pinmap utility functions
Add 2 new pinmap utility functions:
-pinmap_find_peripheral_pins
-pinmap_list_has_pin

Also add the new type PinList which contains a list of pins allowing
for NC and duplicate entries.
2019-02-08 09:10:44 -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 2ed1dc2bfa Add HAL API for qspi pinmap
Add the functions qspi_master_sclk_pinmap, qspi_master_ssel_pinmap and
qspi_master_data0_pinmap-qspi_master_data3_pinmap to all targets with
qspi support.
2019-02-08 09:10:25 -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 22a89773fa Add HAL API for i2c pinmap
Add the functions i2c_master_sda_pinmap, i2c_master_scl_pinmap,
i2c_slave_sda_pinmap and i2c_slave_scl_pinmap to all targets.
2019-02-08 09:10:12 -06:00
Russ Butler 7e8695a2c5 Add HAL API for can pinmap
Add the functions can_rd_pinmap and can_td_pinmap to all targets.
2019-02-08 09:10:10 -06:00
Russ Butler 3bd3aca6db Add HAL API for analog out pinmap
Add the function analogout_pinmap to all targets.
2019-02-08 09:10:05 -06:00
Russ Butler 4818f88d73 Add HAL API for analog in pinmap
Add the function analogin_pinmap to all targets.
2019-02-08 09:09:51 -06:00
deepikabhavnani e2a7b89a90 Sleep manager implements all the API's in platform/mbed_sleep_manager.changes
Not sure why mbed_sleep_manager.c was in hal, moving it to platform
2019-01-15 11:47:51 -06:00
Cruz Monrreal 9e48f755e8
Merge pull request #9260 from deepikabhavnani/flags_fix
Use mbed_error_printf instead of debug for ISR friendly prints
2019-01-10 00:15:24 -06:00
deepikabhavnani 7e5e5361bf Use mbed_error_printf instead of debug for ISR friendly prints
Internally in sleep tracing `debug` was used for trace prints, but
all sleep API's are ISR safe and used in interrupts. This resulted in
hardfaults / errors.

Solution is to use `mbed_error_printf` instead for printing on UART
2019-01-07 10:09:20 -06:00
Kevin Bracey 70af016348 critical sections: remove unnecessary volatile
Critical section count/state variables are synchronised by IRQ disabling and
critical section calls themselves, so do not need to be volatile.

This eliminates a couple of unnecessary reads of the counter variable.
2019-01-03 11:06:44 +02:00
Thomas Kemmer b0a18b32a0 Fix ticker_read_us() race condition. 2018-12-21 20:41:47 +01:00
Alastair D'Silva 2617c5d55b Don't use define checks on DEVICE_FOO macros (mbed code)
The DEVICE_FOO macros are always defined (either 0 or 1).

This patch replaces any instances of a define check on a DEVICE_FOO
macro with value test instead.

Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
2018-12-20 10:16:42 +11:00
Kevin Bracey 02330336f2 Fix target.mpu-rom-end setting, for ARMv8-M too
targets.json was not specifying the same macro name as the code was
checking for, so setting was ineffective.

Making this work tripped up not-supported checks in ARMv8-M - rather than deal
with making this work, support it instead.

Both ARMv7-M and ARMv8-M slightly reduce code size and runtime impact if
mpu-rom-end is 0x1fffffff, using one fewer region.

This means default setup for ARMv8-M now requires 5 regions, with
mpu-rom-end set to default 0x0fffffff, but this can be put back to 4 by
changing the setting.
2018-12-12 15:44:21 +02:00
Kevin Bracey 170b73442b ARMv7-M MPU: correctly protect 80000000 RAM region
Subregion mask for this region was set fully disabled, instead of fully
enabled.
2018-12-12 15:12:50 +02:00
Kevin Bracey 171e575b94 Assert MPU regions, rather than error
As we build for a specific CPU, a runtime check for number of MPU
regions in release builds is not worthwhile. Make it an assert only.
Saves a little space in develop images, a lot in release.
2018-12-12 15:12:49 +02:00
Kevin Bracey 9e300013e5 MPU - use higher-level calls, fix ARMv8-M error
Switch to higher-level calls and macros, and fix an error in the ARMv8-M
version - "inner" attributes were not being set correctly due to a
copy/paste error - "outer" was being set twice.

This means RAM would have been marked WTRA rather than WBWA for the
inner cache.

Slightly reduces ARMv7-M init code size by feeding region number
into RBAR instead of using RNR.
2018-12-12 15:12:49 +02:00
Kevin Bracey 2b5518a3d8 Reduce dynamic MPU code size with a loop 2018-12-11 18:59:59 +02:00
Kevin Bracey e585eac31b Fix MPU synchronisation
Synchronisation instructions were not quite right - too strict on entry,
and not quite correctly synchronising the instruction stream on exit.

References:

* https://static.docs.arm.com/dai0321/a/DAI0321A_programming_guide_memory_barriers_for_m_profile.pdf
* https://static.docs.arm.com/100699/0100/armv8m_architecture_memory_protection_unit_100699_0100_00_en.pdf
2018-12-11 18:59:59 +02:00
Kevin Bracey 842587ddb5 Save ROM by specifying initial MPU state
We can omit the need for the "change MPU state" calls from simple images
by specifying the initial state at init.
2018-12-10 15:53:34 +02:00
Martin Kojtal 4491d1922b
Merge pull request #8956 from c1728p9/don't_ignore_early_interrupts
Update Ticker wrapper to handle early interrupts
2018-12-05 10:40:08 +01:00
Martin Kojtal 6edc81ddae
Merge pull request #8873 from kfnta/psa_spm_docs
PSA-SPM documentation follow-up
2018-12-04 15:38:45 +01:00
Russ Butler 3f06911782 Update Ticker wrapper to handle early interrupts
Update the LowPowerTickerWrapper class to handle rather than ignore
early low power ticker interrupts. This ensures that devices don't get
stuck in sleep due to a ignored early low power ticker interrupt.
2018-12-03 17:55:22 -06:00
Martin Kojtal 406f9508d3 hal: add spdx license 2018-11-28 10:39:51 +00:00
Oren Cohen 11567cdf30 set proper groups for spm and HAL 2018-11-28 12:17:37 +02:00
Oren Cohen 3629e002ee Fix PSA-SPM Documentation 2018-11-28 12:17:36 +02:00
Martin Kojtal 52822cb8af
Merge pull request #8871 from c1728p9/mpu
MPU API (Reopened)
2018-11-28 10:28:32 +01:00
Russ Butler 7cdfbee28b Fix asyle problems
Run astyle to fix CI failures.
2018-11-27 09:29:33 +00:00
Russ Butler 1821d37621 Overhaul MPU for new requirements
Make the following changes:
-Allow a vector specific ARM MPU driver by defining MBED_MPU_CUSTOM
-Allow ROM address to be configured for ARMv7-M devices by
    setting the define MBED_MPU_ROM_END
-Add ROM write protection
    -Add new functions and lock
    -enable at boot
    -disable during flash programming
2018-11-27 09:29:32 +00:00
Russ Butler 7283f9b0ee Add a formal HAL specification for the MPU API
Add a formal HAL specification consisting of:
-defined and undefined behavior
-test descriptions
-enable doxygen for MPU
2018-11-27 09:29:32 +00:00
Russ Butler a4aa5eaf93 Add v8m MPU
Add a driver for the v8m MPU.
2018-11-27 09:29:32 +00:00
Russ Butler d00f59fdc8 Rework MPU layout for future changes
Create a dedicated MPU directory for standard Arm MPU implementations
in preparation for the Arm v8m MPU. Replace MBED_MPU_ENABLED with
DEVICE_MPU to align with the porting layer of other HAL APIs.
2018-11-27 09:29:31 +00:00
Russ Butler 0f5b9eaf94 Add an initial MPU API
Add a minimalistic HAL MPU API with the ability to prevent execution
in ram.
2018-11-27 09:29:31 +00:00
Amanda Butler 34bcf6b1f0 Edit spm_api.h
Edit file, mostly for minor grammar and style changes.
2018-11-27 09:16:48 +02:00
Oren Cohen 773ac8dd95 CR fixes 2018-11-27 09:16:45 +02:00
Oren Cohen dd73fa689c PSA SPM
* Intorduce PSA-SPM to mbed-os
* Add SPM tests (for PSA targets)
* Add PSA PRoT internal storage Secure implementation
* Integrate SPM into the boot proccess
* PSA manifest data generator
* Introduce PSA targets skeleton to mbed-os
* Add artifact delivery to the tools
2018-11-27 09:16:35 +02:00
David Saada 542744d03c Support erase value in Flash HAL drivers, FlashIAP and block devices 2018-11-07 14:23:07 +02:00
Cruz Monrreal 5ed07c2dd4
Merge pull request #8328 from kjbracey-arm/noreturn
Error path tightening: use MBED_NORETURN; add+use core_util_atomic_flag
2018-10-29 20:49:54 -05:00
Kevin Bracey 0b27736536 Remove sleep manager tests that trigger mbed_error
Intercepting mbed_error will be too hard after mbed_error becomes
[[noreturn]], so remove tests that do this.
2018-10-29 13:58:05 +02:00