1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
Commit Graph

164 Commits

Author SHA1 Message Date
Benjamin Valentin
e2addab7f0 cpu/kinetis: RTC use rtc_mktime()
Use RTC helper functions instead of libc functions.
This gives us y2038 safety by the extended epoch
and saves a good chunk of memory:

mktime():

   text	   data	    bss	    dec	    hex	filename
  24756	    232	   2736	  27724	   6c4c	testssperiph_rtc/bin/openlabs-kw41z-mini/tests_periph_rtc.elf

rtc_mktime():

   text	   data	    bss	    dec	    hex	filename
  16348	    132	   2696	  19176	   4ae8	tests/periph_rtc/bin/openlabs-kw41z-mini/tests_periph_rtc.elf
2020-08-27 23:16:02 +02:00
Benjamin Valentin
f53ae74269 cpu/kinetis: set CPU_HAS_BITBAND 2020-07-16 14:44:28 +02:00
Leandro Lanzieri
215e77f2ad
cpu/kinetis: Add Kconfig symbols 2020-07-02 14:41:41 +02:00
Leandro Lanzieri
6ea04d146b
cpu/kinetis: Provide features based on CPU series
Also, rename CPU_FAMILY to the standard CPU_FAM.
2020-07-02 14:41:39 +02:00
Francisco
a46adc3d44
Merge pull request #13742 from benemorius/pr/kinetis-pm_layered
cpu/kinetis: implement power modes for pm_layered
2020-06-26 10:51:12 +02:00
Thomas Stilwell
ae7ec96731 cpu/kinetis: implement power modes for pm_layered 2020-06-21 21:51:16 -05:00
Bas Stottelaar
1bd0e32cb9 cpu/kinetis: remove reference of RTC_NUMOF.
These defines were globally removed in #12673.
2020-06-21 21:29:23 +02:00
c2a7d23277
kinetis/spi_scalar: Add local ARRAY_SIZE define
The spi scalar calculation tool for the kinetis family is stand-alone
and doesn't use the RIOT headers. It doesn't include the ARRAY_SIZE
macro from the RIOT headers. This commit adds a local definition of the
ARRAY_SIZE macro
2020-06-21 17:09:32 +02:00
Leandro Lanzieri
5dc29886b3
cpu/kinetis: Include CPU information in Makefile.features 2020-06-16 12:05:41 +02:00
Leandro Lanzieri
4d65bc8e0a
cpu: Rename CPU_ARCH to CPU_CORE 2020-06-16 12:05:40 +02:00
Leandro Lanzieri
2ad14e4242
cpu/kinetis: Move dependencies to Makefile.dep 2020-05-20 19:46:13 +02:00
Benjamin Valentin
d5dce87e1b Makefile.include: rename MAKEFILEDIR to LAST_MAKEFILEDIR
Rename the variable to make it clearer that it refers to the last Makefile
included.
Usually this is the current file, but when another Makefile is included this
changes.
2020-04-28 15:45:27 +02:00
Benjamin Valentin
c1d05f07a5 cpu/kinetis: use $(MAKEFILEDIR) 2020-04-15 11:51:11 +02:00
Leandro Lanzieri
64552a3b9a
cpu/cortexm_common: Move common modules to Makefile.dep
This moves the following modules to a architecture-specific Makefile.dep
file:
- cortexm_common
- cortexm_common_periph
- newlib
- newlib_nano
- periph
2020-04-01 09:46:21 +02:00
Thomas Stilwell
048fca998b cpu/kinetis: add mkw41z256vht4 to no-hwrng list 2020-03-01 16:56:34 +01:00
92f2b820cd
cpu: remove exports of UNDEF vars 2020-02-25 09:40:34 +01:00
bbf274aecc cpu/kinetis: immediately convert shell expansion of RAM_BASE_ADDR 2020-02-11 13:59:59 +01:00
Marian Buschsieweke
7387cd43d9
cpu/kinetis/periph: adc_sample() now returns int32_t 2020-01-10 14:13:14 +01:00
francisco
7d11e40eac cpu/kinetis: add flashpage for W & K series 2020-01-03 09:57:24 +01:00
Leandro Lanzieri
93788ecced cpu/kinetis/Makefile.features: Use CPU_MODEL to determine features
Now that CPU and CPU_MODEL are defined in the board's Makefile.features
it can be used to determine the available features provided by the
specific model.
2019-12-02 19:04:23 +01:00
3eea508695 cpu/kinetis: fix typos 2019-11-23 22:39:36 +01:00
Francois Berder
4a31f94cfc many typo fixes
Signed-off-by: Francois Berder <18538310+francois-berder@users.noreply.github.com>
2019-11-23 22:39:07 +01:00
Benjamin Valentin
0ea2cbf1eb boards: remove RTT_NUMOF/RTC_NUMOF
Those macros are defined but never used.
2019-11-08 14:20:33 +01:00
Francisco Molina
347a0fc804 cpu/ boards/: remove exports for CPU_FAM 2019-10-18 08:55:33 +02:00
Francisco Molina
5e9b92a326 cpu: remove CPU_ARCH exports 2019-10-18 08:55:33 +02:00
Gunar Schorcht
02d81b717e
Merge pull request #12063 from maribu/i2c_release
drivers/periph/i2c: Updated i2c_release() to return void
2019-10-01 19:50:38 +02:00
Sebastian Meiling
84e6d1571a cpu/kinetis: adapt timer to return 0 on success
Adapt periph/timer implementation of kinetis based MCUs
to return 0 on success for all functions.
2019-09-11 13:46:15 +02:00
benpicco
b6fe0e25fe
Merge pull request #10020 from gebart/pr/kinetis-lptmr-reload
kinetis: lptmr reload instead of spinning
2019-09-11 10:12:58 +02:00
Marian Buschsieweke
df27dbef7a
cpu: Moved stdio_init() into cpu_init()
- Removed stdio_init() from newlib's _init(), as this is too late in the boot
  process to allow DEBUG()ing during periph_init()
- Added stdio_init() to the various cpu_init() routines of the ARM CPUs just
  before periph_init()
2019-09-06 16:54:23 +02:00
Marian Buschsieweke
6b7d27ece9
cpu/kinetis: Updated i2c_release() 2019-08-22 12:03:08 +02:00
Francisco Molina
0ce2081817 cpu/kinetis: re-enable HWRNG for k64f
- Fix SCGx used for RNGA since RNGA is not mapped
  to SCG3 for K64F.
2019-08-09 15:47:13 +02:00
Benjamin Valentin
b8c4ab5b69 cpu: make use of ARRAY_SIZE macro 2019-08-06 19:43:54 +02:00
MrKevinWeiss
ec62f1ccce cpu/kinetis/i2c: Suppress cppcheck unreadVariable warning
On cppcheck 1.82 it throws a warning.
Since it costs cycles and does nothing the ++dummy is (void)dummy.
A warning suppression is added so the CI is happy.
2019-06-21 12:29:14 +02:00
MrKevinWeiss
6419a7a3aa cpu/kinetis/i2c: Fix false positive for expected EIO during i2c write
This fixes the positive result when master write data is NACKed.
This false positive occurs when the write frame is finished but a data nack occurred.
The AF check should occur first.
2019-06-20 16:32:25 +02:00
francisco
42b1118f94 boards/frdm-k64f add riotboot support 2019-06-06 15:20:36 +02:00
francisco
4ca815445d kinetis/Makefile.include: set RIOTBOOT_HDR_LEN to 0x200 for KW2XD
- Minimum required RIOBOOT_HDR_LEN or kW2xD is 0x200
  to respect vector table alignment
2019-06-06 11:59:01 +02:00
Gaëtan Harter
bbb6dec054
Merge pull request #11630 from fjmolinas/pr_kinetis_ld
kinetis/ldscript: handle _rom_offset
2019-06-05 16:12:25 +02:00
francisco
1e0f44c28a kinetis/Makefile.include: cleanup unused LINKFLAGS
- _rom_start_addr, _ram_start_addr, _rom_length and _ran_length are
  already defined in cortexm_common/Makefile.included and can therefore
  be removed from kinetis/Makefile.include
- _ram_base_addr is never used and was not in commit history so
  is also removed
2019-06-04 18:11:55 +02:00
francisco
f0311ce1fa kinetis/ldscript: include _rom_offset
- To be able to flash at an offset the vector table must be
  relocated accordingly to the IMAGE_OFFSET, therefore linkage
  needs to take the offset into account.
2019-06-04 18:05:35 +02:00
smlng
2de4b3011b periph_common: add as dependency to periph drivers
Rational: the periph_common module is required by (most) other periph drivers
and also during startup of the CPU/MCU to run periph_init. The latter is only
required if other periph drivers are used, hence periph_common should be a
depency of periph_* modules and *not* of the CPU/MCU. This PR fixes that
by making periph_common a depency of periph_* and removing the explicit
include in the CPU/MCU implementation.
2019-06-03 13:44:10 +02:00
Gaëtan Harter
e40d569204
kinetis: save 'wdog-disable.bin' binary in the repository
Keep the compiled '.bin' file to remove the need to compile it when
flashing. This remove the need to have the toolchain when flashing so
allow compiling and flashing with `BUILD_IN_DOCKER=1` without a local
toolchain.

Even if it ends up storing a binary, the file is only 34 bytes.
2019-05-28 14:37:11 +02:00
Gaëtan Harter
984cbc7e41
cpu/kinetis/check-fcfield: use OBJDUMP
Get OBJDUMP from the environment instead of hardwriting the value.

This is a prerequisite to allow using `objdump` when building from docker
when not having the `arm` toolchain installed.
2019-05-28 14:36:37 +02:00
francisco
c219fdc001 kinetis/check-fcfield: skip on IMAGE_OFFSET > 0x410
- fcfield is located in memory at 0x400-0x40f. Its content is only read
  upon reset, therefore if in presence of a bootloader and multiple
  applications, the fcfield will only be read when the bootloader
  is loaded. As long as we flash at IMAGE_OFFSET > 0x410 we do not
  care about the fcfield content since it won't get overwritten.
2019-05-28 10:19:00 +02:00
francisco
7156977fed kinetis/check-fcfield: add fcfield verirication for bin files 2019-05-27 17:43:19 +02:00
francisco
963bbe75ba kinetis/check-fcfield: merge hex and elf script 2019-05-27 17:38:46 +02:00
Gaëtan Harter
19224ec1d5
kinetis: move filtering-out periph_hwrng in cpu/kinetis
This removes doing `filter-out periph_hwrng, $(FEATURES_PROVIDED)`
after processing `cpu/$(CPU)/Makefile.features`.
The current solution is a HACK as `CPU_MODEL` is currently not available
at that moment but will be in the near future.

It will allow always including `cpu/$(CPU)/Makefile.features` after
`boards/$(BOARD)/Makefile.features`.

It is a part of moving `CPU/CPU_MODEL` definitions to `Makefile.features`.
2019-05-06 15:12:47 +02:00
e089b1eb02
cpu/kinetis: define ROM_LEN with a non arithmetic value
It must be evaluated in `cortexm_common` without a shell context.
The `K` is correctly handled by both the linker and `cortexm_common`.

Co-authored-by: Gaëtan Harter <gaetan.harter@fu-berlin.de>
2019-03-23 12:14:21 +01:00
Anton Gerasimov
19d2ef736c kinetis: limit scope of a variable in ics.c to make Codacy happy
Signed-off-by: Anton Gerasimov <tossel@gmail.com>
2019-01-26 15:53:05 +01:00
Anton Gerasimov
40bcfc9211 kinetis: add support for S9KEAZ128
Signed-off-by: Anton Gerasimov <anton.gerasimov@here.com>
2019-01-26 15:53:05 +01:00
Thomas Stilwell
3ea75d1314 cpu/kinetis/rtt: clear subseconds when writing seconds 2019-01-13 17:43:19 -08:00
Joakim Nohlgård
fa3b9168a0 kinetis: lptmr reload instead of spinning
Spinning for the correct time has the side effect that it may cause
infinite recursion if the callback function calls timer_set.

timer_set->callback->...->timer_set->callback->...->timer_set-> infinity

In theory, the drawback is that the callback for very short timeouts
(<2 lptmr ticks) may be delayed up to 2 lptmr ticks (61 µs)

In practice however, tests performed using tests/bench_timers shows that
this change only affects the accuracy of the timer target when timer_set
is called with a timeout of 0, which results in a delay of 30 µs.
2018-12-14 12:01:39 +01:00
Joakim Nohlgård
158a8300c4 kinetis: LPUART: Compute oversampling rate at init
By not forcing a fixed oversampling rate we can achieve better baud rate
accuracy than otherwise possible.
For example, when requesting 115200 with a module clock of 4 MHz,
picking an oversampling rate of 17 (instead of hardware
default 16) yields 117647 baud instead of 125000 baud as the best
matching rate. Better matching baud rate between receiver and
transmitter results in a lower probability of transmission errors.
2018-11-29 14:24:16 +01:00
Joakim Nohlgård
870385530d kinetis: Allow override of FOPT setting in fcfield.c 2018-11-28 00:21:35 +01:00
Joakim Nohlgård
d63672798e kinetis: Allow FOPT settings other than 0xff
These bits configure some early boot options and may be necessary to
use on certain boards to ensure a robust boot sequence.
2018-11-27 16:00:42 +01:00
Joakim Nohlgård
8bb73f237d kinetis: GPIO: avoid dup calls to cortexm_isr_end on KW41Z
Devices with combined IRQs would call the cortexm_isr_end handler twice
when it is part of the irq_handler routine.
2018-11-08 14:52:10 +01:00
Joakim Nohlgård
b9ceac5ccc kinetis: Optimize GPIO IRQ handler
Measurements show that the time from pin edge until return from
interrupt is reduced from 22 us to 6.1 us for KW41Z running at
41.94 MHz. The measurements used a no-op GPIO callback for testing and
were measured using an external logic analyzer.
2018-11-08 14:52:10 +01:00
Martine Lenders
53a9797e56 kinetis: mark closing #endif for MODULE_PERIPH_GPIO_IRQ 2018-10-09 15:11:00 +02:00
Joakim Nohlgård
7a857a939c
Merge pull request #9807 from gebart/pr/kinetis-adc-average
kinetis: ADC: Add hardware averaging configuration
2018-09-26 12:54:29 +02:00
Hauke Petersen
e71281943a cpu/kinetis/gpio: use gpio_irq feature 2018-09-26 09:53:30 +02:00
smlng
59e299635b cppcheck: add/correct reason for cppcheck-suppress
Adding and correcting description/rational on why certain cppcheck
warnings or errors are intentionally suppressed.
2018-09-25 12:03:58 +02:00
Joakim Nohlgård
dd2fad6b9b kinetis: ADC: Add hardware averaging configuration
This allows a board configuration to select which kind of averaging
should be applied to the pin instead of always using 32 sample average.
Very high impedance sources may need to disable hardware averaging in
order to give correct values, the on-chip temperature sensor is one such
signal source.
2018-09-12 16:32:48 +02:00
Joakim Nohlgård
8996cbe313 make: Introduce new feature flag periph_gpio_irq 2018-08-29 08:53:20 +02:00
Martine Lenders
426cfbeea6 kinetis: timer: #ifdef unused functions
Another issue revealed by compiling several apps with LLVM/clang for
the `teensy31` board.
2018-08-13 18:38:13 +02:00
Martine Lenders
376c10feff kinetis: uart: fix unused-function warning
When compiling with LLVM (should also be seen `-Wunused-function` in
GCC), I get an error for `frdm-k22f`. This should fix that.
2018-08-08 10:02:53 +02:00
smlng
0b9a54f184 cpu/kinetis: suppress selfAssignement warning by cppcheck
cppcheck raises a warning due to self assignment. As this is
    intentional to clear all IRQ on register status flags, this
    warning is suppressed now.
2018-07-25 12:01:40 +02:00
Joakim Nohlgård
31b461d71c kinetis: Interrupt based I2C transfers 2018-07-25 12:01:39 +02:00
Joakim Nohlgård
175f398b58 kinetis: Refactor I2C driver 2018-07-25 12:01:39 +02:00
Joakim Nohlgård
3ac45b5aa2 kinetis: Reflow text in doc.txt 2018-07-25 12:01:38 +02:00
Joakim Nohlgård
172af17ae4 kinetis: Conditionally enable MCG 2018-06-30 19:14:59 +02:00
Joakim Nohlgård
28fe4b8653 kinetis: Clean up SPI module power handling
Fixes a problem with hardware CS when using slow SPI speeds,
mentioned in https://github.com/RIOT-OS/RIOT/issues/6437#issuecomment-283114795
2018-06-27 19:21:39 +02:00
938677cc83 cpu*: fix doxygen grouping 2018-06-11 19:12:02 +02:00
Francisco Acosta
9a0f3469b7
Merge pull request #8930 from gebart/pr/kinetis-rtt-refactor
kinetis: Refactor RTT driver
2018-05-30 14:54:15 +02:00
Francisco Acosta
6e484f7aed
Merge pull request #8814 from gebart/pr/kinetis-periph-timer-tfc
cpu/kinetis: Refactor LPTMR timer implementation
2018-05-29 15:54:11 +02:00
Loïc Dauphin
b7a8ba73a9
Merge pull request #8933 from gebart/pr/kinetis-pit-refactor
kinetis: Refactor PIT timer driver implementation
2018-05-29 11:09:55 +02:00
Joakim Nohlgård
09e0e8953d kinetis: GPIO: Enable the correct IRQn on CM0+ 2018-05-24 23:54:56 +02:00
Joakim Nohlgård
fb73067494 kinetis: Refactor PIT driver
Stop prescaler instead of counter channel to avoid the need for saving
and restoring timeouts
2018-05-22 16:47:35 +02:00
Joakim Nohlgård
16af9b0beb kinetis: Clean up PIT timer implementation 2018-05-22 16:47:23 +02:00
Joakim Nohlgård
a6c30ab61d kinetis: Move RTT config to periph_cpu.h 2018-05-22 16:46:39 +02:00
Joakim Nohlgård
c7801e466d kinetis: Refactor RTT driver
- Keep counter value between resets
- Let kinetis_mcg_init manage the RTC oscillator, to avoid disrupting
  the core clock in certain configurations
- Remove some unnecessary macros for hardware abstraction; all Kinetis
  CPUs which have an RTC only have a single RTC instance, and the ISRs
  and hardware registers are named the same way in all Kinetis CPU
  headers.
2018-05-22 16:46:39 +02:00
Joakim Nohlgård
9e10cd4401 cpu/kinetis: Refactor LPTMR driver implementation
Uses timer freerunning counter mode (TFC) and updating an internal
reference point instead of relying on RTT for reference time. The
target accuracy has been greatly improved for all test cases in
bench_periph_timer
2018-05-22 16:45:41 +02:00
Joakim Nohlgård
179e8505ba kinetis: Const ISR vector padding
Fixes misleading .data usage in size output because the .vectors section
is now properly marked as read-only in the ELF file.
2018-05-09 00:32:28 +02:00
Joakim Nohlgård
321aa567d6 kinetis: Memory segment attribute fixes
vectors and flashsec memory segments will not be considered for orphan
sections if rx is only given for the rom segment.
2018-05-05 08:11:00 +02:00
Joakim Nohlgård
c54f6b4fcf kinetis: Refactor clock generator initialization 2018-04-17 06:59:22 +02:00
Gaëtan Harter
fff5810191 Makefile.include: FIX .DEFAULT_GOAL not being all
.DEFAULT_GOAL was reset many times which removed 'all' from being the default
goal.
By chance it was then set to `link` so was working by some magic.
2018-03-28 16:59:00 +02:00
Hauke Petersen
47a500d0b1
Merge pull request #8447 from haukepetersen/opt_test_periphuartpower
tests/periph_uart: included power_on/off() in test
2018-03-05 09:49:20 +01:00
Joakim Nohlgård
68ea6b3316 kinetis: Add support for NXP Kinetis KW41Z SoC 2018-03-02 15:38:39 +01:00
Joakim Nohlgård
2090dd0234 kinetis: Add GPIO ISR for CPUs with combined PORTB+PORTC interrupt 2018-03-02 15:38:39 +01:00
Joakim Nohlgård
8642c8ceb8 kinetis: Support CM0+ devices with 96 bit UID 2018-03-02 15:38:39 +01:00
Joakim Nohlgård
005b4bfbb3 kinetis: Filter out PWM code if no FTM exists 2018-03-02 15:38:39 +01:00
Joakim Nohlgård
11361ec7e1 kinetis: Add support for CPUs with a single IRQ for all PIT channels 2018-03-02 15:38:39 +01:00
Joakim Nohlgård
2b64452c33 kinetis: GPIO workaround for missing open drain support 2018-03-02 15:38:39 +01:00
Joakim Nohlgård
a196bb431d kinetis: Only configure PWM settings if the FTM device exists 2018-03-02 15:38:39 +01:00
Joakim Nohlgård
ba76402d03 kinetis: Add Bit Manipulation Engine helpers 2018-03-02 15:38:39 +01:00
Joakim Nohlgård
18908667a3 kinetis: Make open drain GPIO availability depend on CPU header 2018-03-02 15:38:39 +01:00
Joakim Nohlgård
2bdf0bfbf1 kinetis: Align definitions in cpu_conf_kinetis.h 2018-03-02 14:39:00 +01:00
Joakim Nohlgård
82e960b642 kinetis: Set LPUART clock source during uart_lpuart_init 2018-03-02 14:39:00 +01:00
Francisco Acosta
2e701bd535
Merge pull request #8725 from gebart/pr/kinetis-errata-func
kinetis: Move errata workarounds to separate function
2018-03-02 12:30:16 +01:00
Francisco Acosta
a31940eee4
Merge pull request #8723 from gebart/pr/kinetis-periph-cpu-doc-fix
kinetis: periph_cpu.h doc fix
2018-03-02 12:03:06 +01:00
Hauke Petersen
8ac3465ba7 cpu/kinetis: add empty uart/power_x functions 2018-03-02 10:53:55 +01:00
Joakim Nohlgård
fd76e5ddad kinetis: Move errata workarounds to separate function 2018-03-02 08:17:00 +01:00