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

247 Commits

Author SHA1 Message Date
benpicco
b35ef08094
Merge pull request #12901 from benpicco/lpc2387-stacks
cpu/lpc2387: use the same default stack sizes as cortexm_common
2019-12-18 14:12:58 +01:00
Benjamin Valentin
a90663c9e7 cpu/lpc2387: provide ISR_STACKSIZE & thread_isr_stack_start()
Those are needed by MicroPython
2019-12-17 13:37:32 +01:00
Benjamin Valentin
b1808800ed cpu/lpc2387: align lpc2387.ld with cortexm_base.ld
For better compatibility copy most of cortexm_base.ld
and use the same section names.

Only interrupt stacks and the two additional (currently unused)
heap sections are different between the two now.
2019-12-09 15:13:53 +01:00
Benjamin Valentin
d57e03c94c cpu/lpc2387: use the same default stack sizes as cortexm_common
Both architectures are variants of the ARM architecture and use the same
toolchain.
There is no reason to have such wildly different defaults.

This results in some tests passing that would crash before:

 - [x] `tests/pkg_libcose`
 - [x] `tests/pkg_qdsa`
 - [x] `tests/pkg_relic`
 - [x] `tests/pkg_tweetnacl`
 - [x] `tests/pthread_tls`

`THREAD_EXTRA_STACKSIZE_PRINTF_FLOAT` is not used anywhere in RIOT
anymore, so just drop it.
2019-12-08 22:07:57 +01:00
Benjamin Valentin
f89b852c1d cpu/lpc2387: clean up lpc2387.ld
Clean up the linkerfile and bring it more in line with cortexm_base.ld
(so far only for the ROM part)

As a bonus, tests/cpp_ctors works now.
2019-11-29 12:13:21 +01:00
Benjamin Valentin
ed0f72c856 cpu/lpc2387: startup.s: remove dead code
Setting up the .data and .bss section happens in arm7_init.c now.
The code was commented out anyway, so just remove it.
Also remove leftover variable declarations that were only used in
the dead code.
2019-11-29 12:00:52 +01:00
Benjamin Valentin
32bbba2fc5 cpu/lpc2387: add support for backup RAM
lpc23xx has 2k of battery RAM that is retained in Deep Power Down mode.

To not overwrite that data it must only be initialized on Power On Reset.
However, RSIR looks the same when waking up from Deep Power Down as it does
on the power-on case.

So use 4 bytes of the backup RAM to keep a signature that is only valid if
memory was retained (no power-on Reset).

A small change to the linker script is required so two sections can be
placed into flash.
2019-11-28 11:33:03 +01:00
Benjamin Valentin
15fcbe837a cpu/lpc2387: add definition of RSIR bits
Add the bits of the Reset Source Identification Register
2019-11-28 11:30:38 +01:00
Benjamin Valentin
964725259a cpu/lpc2387: implement periph/dac
The 10 bit DAC on the lpc23xx is very simple.
It only has one channel and can only be mapped to a single pin (P0.26).

After setting the pin mode to DAC no further configuration in needed.
2019-11-26 01:49:45 +01:00
Benjamin Valentin
8337ab111e cpu/arm7_common: hook up puf_sram
puf_sram only relies on an uninitialized chunk of memory.
This means to enable it we just have to hook up puf_sram_init().

All memory after __bss_end should be uninitialized at startup, so
just use that.
2019-11-25 02:04:34 +01:00
c6a80b4f4b cpu/lpc2387: 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
8424d1845b cpu/lpc2387: fix doxygen errors
Document macros and remove an unused function.
2019-11-22 09:11:39 +01:00
Benjamin Valentin
a9d1825e2e cpu/lpc2387: implement periph/pm
Enable IDLE and Deep Powerdown mode.

IDLE is pretty straightforward - insteady of busy waiting, the CPU will
enter an idle state from which it will resume on any event.

Deep Power Down shuts off the entite system except for the battery backup
power domain.
That means the CPU will reset on resume and can be woken by e.g. RTC.

SLEEP and POWERDOWN disable the PLL and the PLL and Flash respectively.
This requires some proper wake-up handling.

Since this turned out to be a major time sink and those modes are never
currently never used in RIOT outside of tests, I left this as an exercise
for a future reader.
2019-11-22 09:11:39 +01:00
Yegor Yefremov
fa3b0ff04b doxygen/SPI: don't include overridden typedefs
Add missing #ifndefs to overridden SPI typedefs.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2019-11-15 10:35:32 +01:00
Marian Buschsieweke
72714aefea
cpu/lpc2387: Added MCU provided features
Added features provided by the LPC2387 MCU to cpu/lpc2387/Makefile.features
2019-11-08 14:02:35 +01:00
Benjamin Valentin
9e68556393 boards/msba2: configure remaining UARTs
All UARTs on the MSBA2 are exposed through pin headers on the board.
Configure them according to the data sheet.
2019-11-07 21:55:25 +01:00
Benjamin Valentin
c544c41804 cpu/lpc2387: fix indent 2019-11-07 21:55:24 +01:00
Benjamin Valentin
d6a94d4e18 cpu/lpc2387: uart driver overhaul
This converts the hard-coded UART driver to the new ways.

 - allow the board to configure the RX & TX pins
 - allow for more than one UART
 - allow setting the baudrate
 - implement poweron()/poweroff() functions
2019-11-07 21:55:24 +01:00
Benjamin Valentin
5ec9f62a0b cpu/lpc2387: add UART register map 2019-11-04 01:21:08 +01:00
Martine Lenders
ea4b78654f
Merge pull request #12285 from JulianHolzwarth/pr/posix/pthread/pthread_reaper_fix
sys/posix/pthread/pthread.c: fix pthread reaper
2019-10-29 18:56:36 +01:00
Marian Buschsieweke
d4adcfd92d
Merge pull request #12581 from benpicco/lpc2387-xtal_select
cpu/lpc2387: allow for more flexible clock selection
2019-10-28 12:32:11 +01:00
Benjamin Valentin
d6ca62576d cpu/lpc2387: allow use of other XTALs
Currently the cpu/lpc2387 init code hard-codes a 16 MHz
external oscillator.
Instead, calculate the PLL multiplier based on the board define
and also allow to run without an external oscillator.
2019-10-28 11:11:40 +01:00
Benjamin Valentin
985fb53c9f cpu/lpc2387: enable RTC on init
All other CPU implementations have the RTC running after
rtc_init() was called.

Fix this for lpc2387.
2019-10-27 01:33:13 +02:00
Gaëtan Harter
1e561e9f63 cpu/lpc2387: increase 'pthread_reaper' stacksize
At the time of configuration, the pthread-reaper uses '164' bytes of
stack when 'idle' stack is only '160'. By having double it gives some
margin.

ps
        pid | name                 | state    Q | pri | stack  ( used) | base addr  | current
          1 | idle                 | pending  Q |  15 |    160 (  128) | 0x4000007c | 0x4000009c
          2 | main                 | running  Q |   7 |   2560 ( 1232) | 0x4000011c | 0x4000095c
          3 | pthread-reaper       | bl rx    _ |   0 |    320 (  164) | 0x40000bac | 0x40000c48
            | SUM                  |            |     |   3040 ( 1524)
2019-09-25 16:17:01 +02:00
Benjamin Valentin
e3b0874305 cpu/lpc2387: clean up the platform
- move clock setup from boards/ to cpu/
 - reduce code duplication
2019-09-16 13:08:56 +02:00
Benjamin Valentin
b1724a7d1b periph/rtc: normalize struct tm before usage
A naive implementation may set a RTC alarm in 30s by calling

	struct tm now;
	rtc_get_time(&now);
	now.tm_sec += 30;
	rtc_set_alarm(&now, _cb, NULL);

This works for RTC implementations that use a RTT internally and call
mktime() to convert the struct tm to a unix timestamp, as mktime() will
normalize the struct in the process.

Call rtc_tm_normalize() when the RTC uses separate registers for time / date
components to ensure it is normalized.

This also modifies tests/periph_rtc to exercise this case.
2019-09-12 11:32:31 +02:00
Marian Buschsieweke
2d415d16c9
cpu/arm7_common: Cleaned up interrupt vectors
- split up interrupt vector code from bootloader.c to vectors.c
- moved bootloader.c to arm7_init.c
- Use consistent naming:
    - use lower case for everything but preprocessor stuff
    - ISRs now named isr_foo()
2019-07-25 22:41:08 +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
Benjamin Valentin
1c3f96495d ldscripts: move .noinit section behind .bss section
If the .noinit section starts at the beginning of the RAM,
a bootloader that is unaware of it will clear it.
Instead, move it behind the .bss section, hoping that a bootloader
will always use less .bss memory than RIOT proper.
2019-05-16 23:11:45 +02:00
Martine Lenders
0ed57df4b5 lpc2387: mark closing #endif for MODULE_PERIPH_GPIO_IRQ 2018-10-09 15:11:00 +02:00
Hauke Petersen
72986ecb9b cpu/lpc2387/gpio: use gpio_irq feature 2018-09-21 08:19:15 +02:00
Marian Buschsieweke
f31375a152
cpu/lpc2387: Use PRIu32 in DEBUG() in mci 2018-08-14 15:35:12 +02:00
Marian Buschsieweke
6358e75f01
cpu/lpc2387: Fixed bug and readability in IAP
- Previous cast was to a function pointer was not legal
- Using already present function pointer to store the IAP entry point to improve
  readability. (Which also fixes the cast issue.)
2018-08-14 15:31:43 +02:00
Marian Buschsieweke
18ae7652a9
cpu/lpc2387: Fixed doc and attribute of arm_reset
- arm_reset was completely undocumented, even though technical details buried
  deeply in the data sheet of the LPC2387 are involved in the code
- The attribute "naked" is misplaced, it should only be used when no C code
  is present. However, the function consists of C code only
- The attribute "noreturn" has to be used in the declaration [1] of a function,
  not in the implementation. Otherwise the caller is not informed and code using
  the function will not be optimized.

[1]: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html
2018-08-14 10:40:09 +02:00
Andreas "Paul" Pauli
1aaeecf5b1
Merge pull request #9296 from maribu/lpc2387
cpu/lpc2387: Various fixes for GPIO driver
2018-06-21 19:28:53 +02:00
Peter Kietzmann
6fd4009b89
Merge pull request #8957 from aabadie/pr/cpu/guard_lpc2387
cpu/lpc2387: remove useless periph file guard
2018-06-20 09:06:31 +02:00
Marian Buschsieweke
1d0f90dcdf
cpu/lpc2387: Various fixes for GPIO driver
- Fixed documentation
- Use bitwise operation instead of multiplication and addition in `GPIO_PIN()`
- Allow GPIOs to be configured as input via `gpio_init()`
- Fixed bugs in `gpio_init_mux`:
    - `0x01 << ((pin & 31) * 2)` was used before to generate the bitmask, but
      this would shift by 62 to the left. Correct is `0x01 << ((pin & 15) * 2)`
      (See [datasheet](https://www.nxp.com/docs/en/user-guide/UM10211.pdf) at
      pages 156ff)
    - Only one of the two bits was cleared previously
- Changed strategy to access GPIO pins:
    - Previous strategy:
        - Set all bits in FIOMASK except the one for the pin to control to
          disable access to them
        - Set/clear/read all pins in the target GPIO port (but access to all but
          the target pin is ignored because of the applied FIOMASK)
    - New strategy:
        - Set/clear/read only the target pin
    - Advantages:
        - Only one access to a GPIO register instead of two
        - Proven approach: Access to GPIOs on lpc2387 is mostly done by
          accessing the GPIO registers directy (e.g. see the sht11 driver).
          Those accesses never touch the FIOMASK register
        - No unwanted side effects: Disabling all but one pin in a GPIO port
          without undoing that seems not to be a good idea
2018-06-18 09:10:25 +02:00
938677cc83 cpu*: fix doxygen grouping 2018-06-11 19:12:02 +02:00
Marian Buschsieweke
2c901ff181
cpu/lpc2387: Fixed invalid call to send_msg in lpc2387-mci.c
At `lpc2387-mci.c:383` in `send_cmd()` an `assert()` enforces that parameter
`buff` is not `NULL`. At `lpc2387-mci.c:538` in `mci_initialize()` `send_cmd()`
was called with `buff==NULL`.
2018-05-30 09:09:22 +02:00
Marian Buschsieweke
17a5101b40
cpu/lpc2387: Fixed broken SPI driver
In commit 513b20ffd3 the SPI API was changed to
power up an configure the SPI bus on spi_acquire(). Sadly, the lpc2387 SPI
apparently needs to be reconfigured after each power up. This commit moves
the initialization code required after each power up from spi_init() to
spi_acquire().
2018-05-19 18:12:25 +02:00
Joakim Nohlgård
60b13e680c lpc2387: Adjust ldscript memory segment attributes 2018-05-09 06:46:05 +02:00
bcab6bd1ba cpu/lpc2387: remove useless periph file guard 2018-04-16 10:11:47 +02:00
Hauke Petersen
2fc724db7e cpu/lpc2487: add empty uart/power_x functions 2018-03-02 10:53:55 +01:00
7847a91e12 cpu: instead of cpp-style, use C-style comments 2018-02-06 16:59:58 +01:00
smlng
7309171303 build: fix unused parameter errors
cpu, sam0_common: fix unused parameter in periph/spi
        cpu, kinetis_common: fix unused parameter in periph/spi
        cpu, cc2538: fix unused param in periph/i2c
        cpu, cc2538: fix unused param in periph/spi
        cpu, sam3: fix unused param in periph/spi
        cpu, stm32_common: fix unused param in periph/pm
        cpu, stm32f3: fix unused params in periph/i2c
        cpu, nrf5x_common: fix unused param in periph/gpio
        cpu, nrf5x_common: fix unused param in periph/spi
        cpu, lpc2387: fix unused params in periph/spi
        cpu, cc2538: fix unused params in radio/netdev
        cpu, cc2650: fix unused params in periph/uart
        cpu, lm4f120: fix unused param in periph/spi
        cpu, lm4f120: fix unused params in periph/timer
        cpu, lm4f120: fix unused params in periph/uart
        cpu, stm32_common: fix unused params in periph/dac
        cpu, stm32l0: fix unused params in periph/i2c
        cpu, msp430fxyz: fix unused params in periph/uart
        cpu, mips: fix unused params
        cpu, cc430: fix unused-params in periph/timer
        cpu, msp430fxyz: fix unused params in periph/spi
        drivers, cc2420: fix unused param
        cpu, mips32r2_common: fix unused params in periph/timer
        cpu, cc2538: fix unused-param in periph/i2c
        cpu, mips32r2_common: fix unused-param in periph/timer
        cpu, msp430fxyz: fix unused params in periph/timer
        cpu, atmega_common: fix unused params in periph/spi
        driver, nrfmin: fix unused params
        cpu, cc2538_rf: fix unused params
        driver, netdev_ieee802514: fix unused param
        cpu, mip_pic32m: fix unused params
        cpu, lpc2387: fix unused params in periph/pwm
        tests/driver_sdcard_spi: fix unused params
        cpu, sam3: fix unused param in periph/pwm
        tests/driver_dynamixel: fix unused params, and style issues
        cpu, cc430: fix unused param in periph/rtc
        cpu, atmega_common: fix unused params in periph/i2c
2017-11-28 14:36:01 +01:00
a20745b6c5 cpu: make use of Makefile.periph 2017-11-06 12:01:19 +01:00
942cc7598b cpu: arm7: reorganize Makefile.features 2017-11-02 12:59:45 +01:00
Francisco Acosta
f2efd88f98 Merge pull request #7129 from haukepetersen/opt_periph_sharetimerset
cpu: add and use shared code for timer_set()
2017-08-01 15:09:48 +02:00
smlng
01af6d94c4 cpu, periph: retain constness in spi_transfer_bytes 2017-06-29 15:47:13 +02:00