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

33 Commits

Author SHA1 Message Date
bors[bot]
149cee491e
Merge #19760 #19946 #19956 #19957
19760: cpu/sam0_common/periph: add low-level SDMMC peripheral driver for SDHC r=benpicco a=gschorcht

### Contribution description

This PR implements the low-level SDIO/SDMMC peripheral driver for SAM0 SDHC according to the definition in #19539.

### Testing procedure

```
BOARD=same54-xpro make -C tests/drivers/sdmmc
```
```
BOARD=same54-xpro make -C tests/sys/vfs_default
```

### Issues/PRs references

~Depends on PR #19539~
Depends on PR #19899

19946: posix_sockets.c: Fix 2 byte int compilation errors r=benpicco a=mrdeep1



19956: cpu/esp32: fix heap definition for ESP32-S2 and ESP32-S3 r=benpicco a=gschorcht

### Contribution description

For ESP32-S2 and ESP32-S3 the symbol `_heap_end` must not be used as `_eheap` for the newlibc `malloc` and function `sbrk`.

`_heap_end` is used by the ESP-IDF heap implementation `esp-idf-heap` and points to the highest possible address (0x40000000) that could be used for the heap in ESP-IDF. It doesn't point to the top address of the unused SRAM area that can be used in newlibc `malloc` and function `sbrk`. Instead, the origin and the length of `dram0_0_seg` must be used to calculate the end of the heap `_eheap`.

The problem only occurs for the newlibc `malloc` when the `sbrk` function is used but not for the ESP-IDF heap implementation `esp_idf_heap`.

### Testing procedure

Use any ESP32-S2 or ESP32-S3 board and flash `tests/sys/malloc`, e.g.
```
CFLAGS='-DCHUNK_SIZE=16384' USEMODULE='stdio_uart' BOARD=esp32s3-pros3 make -j8 -C tests/sys/malloc flash
```
Without the PR the `nm` command will give the wrong address 
```
nm -s tests/sys/malloc/bin/esp32s3-pros3/tests_malloc.elf | grep _eheap
40000000 A _eheap
```
The test will stuck, i.e. the allocation of memory stops when the top of unused SRAM is reached and the board restarts when the watchdog timer expires. With the PR it should work as expected
```
Help: Press s to start test, r to print it is ready
START
main(): This is RIOT! (Version: 2023.10-devel-309-g4669e)
calloc(zu, zu) = 0x10000000
CHUNK_SIZE: 16384
NUMBER_OF_TESTS: 3
Allocated 16384 Bytes at 0x3fc8c4b0, total 16384
...
Allocated 16384 Bytes at 0x3fcec6f0, total 409792
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x7 (TG0WDT_SYS_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x403763e3
```

With this PR the `nm` command should give a address in unused SRAM address space
```
nm -s tests/sys/malloc/bin/esp32s3-pros3/tests_malloc.elf | grep _eheap
3fcca000 A _eheap
```
and the test should pass.

### Issues/PRs references


19957: cpu/esp32: fix Octal SPI RAM for ESP32-S3 r=benpicco a=gschorcht

### Contribution description

This PR fixes Octal SPI RAM handling for ESP32-S3.

Functions that are used during the initialization of the Octal SPI RAM must reside in IRAM instead of Flash. Otherwise, the system stucks during boot once the Octal SPI RAM is enabled. The reason is that the Flash is not available during the initialization of the Octal SPI RAM and the functions that are called during that initialization can't be accessed in Flash. As a result the call of such a function leads to code that is messed up and the system crashes.

The PR also includes the documentation fixe for the `esp32s3-box`. It also includes a small documentation fix regarding the SPI RAM for the `esp32s3-pros3` board.

### Testing procedure

Use a board that has Octal SPI RAM and flash `tests/sys/malloc`, e.g.:
```
CFLAGS='-DCHUNK_SIZE=16384' USEMODULE='stdio_uart esp_spi_ram esp_log_startup' \
BOARD=esp32s3-box make -C tests/sys/malloc
```
Without the PR, the system stuck during boot once the information for the Octal SPI RAM is print
```
ESP-ROM:esp32s3-20210327
...
I (133) boot: Loaded app from partition at offset 0x10000
I (134) boot: Disabling RNG early entropy source...
vendor id : 0x0d (AP)
dev id    : 0x02 (generation 3)
density   : 0x03 (64 Mbit)
good-die  : 0x01 (Pass)
Latency   : 0x01 (Fixed)
VCC       : 0x01 (3V)
SRF       : 0x01 (Fast Refresh)
BurstType : 0x01 (Hybrid Wrap)
BurstLen  : 0x01 (32 Byte)
Readlatency  : 0x02 (10 cycles@Fixed)
DriveStrength: 0x00 (1/1)
```
and the board restarts when the watchdog timer expires.

With this PR, the system starts as expected.
```
ESP-ROM:esp32s3-20210327
...
I (132) boot: Loaded app from partition at offset 0x10000
I (133) boot: Disabling RNG early entropy source...
vendor id : 0x0d (AP)
dev id    : 0x02 (generation 3)
density   : 0x03 (64 Mbit)
good-die  : 0x01 (Pass)
Latency   : 0x01 (Fixed)
VCC       : 0x01 (3V)
SRF       : 0x01 (Fast Refresh)
BurstType : 0x01 (Hybrid Wrap)
BurstLen  : 0x01 (32 Byte)
Readlatency  : 0x02 (10 cycles@Fixed)
DriveStrength: 0x00 (1/1)
Found 64MBit SPI RAM device
SPI RAM mode: sram 40m
PSRAM initialized, cache is in normal (1-core) mode.
Pro cpu up.
Single core mode
SPI SRAM memory test OK
Initializing. RAM available for dynamic allocation:
At 3FC8C150 len 00053EB0 (335 KiB): D/IRAM
At 3FCE0000 len 0000EE34 (59 KiB): STACK/DRAM
At 3FCF0000 len 00008000 (32 KiB): DRAM

Starting ESP32x with ID: f412fafd0f8c
ESP-IDF SDK Version v4.4.1

Current clocks in Hz: CPU=80000000 APB=80000000 XTAL=40000000 SLOW=150000
PRO cpu is up (single core mode, only PRO cpu is used)
PRO cpu starts user code
Adding pool of 8192K of external SPI memory to heap allocator
Used clocks in Hz: CPU=80000000 APB=80000000 XTAL=40000000 FAST=8000000 SLOW=150000
XTAL calibration value: 3643448
Heap free: 8754851 bytes

Board configuration:
	UART_DEV(0)	txd=43 rxd=44
	LED		pins=[ ]
	BUTTONS		pins=[ 0 ]

Starting RIOT kernel on PRO cpu
Help: Press s to start test, r to print it is ready
```

### Issues/PRs references


Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
Co-authored-by: Jon Shallow <supjps-libcoap@jpshallow.com>
2023-09-29 08:36:50 +00:00
Gunar Schorcht
cb88b86693 cpu/esp32: place code for SPI RAM in IRAM 2023-09-29 09:01:12 +02:00
Gunar Schorcht
3a40e20452 cpu/esp32: fix ld scripts for heap
For ESP32-S2 and ESP32-S3 the symbol `_heap_end` must not be used as `_eheap` for dynamic memory allocation, because it points to the highest possible address that could be used for the heap, but not to the top address of the unused SRAM area. Instead, the origin and length of `dram0_0_seg` must be used to calculate the end of the heap.
2023-09-29 08:12:59 +02:00
Gunar Schorcht
87a9d635c8 cpu/esp32: ensure correct RAM_START_ADDR and RAM_LEN 2023-06-25 18:12:57 +02:00
Gunar Schorcht
80833a74e8 cpu/esp32: add flashpage support to linker scripts 2023-01-07 10:38:52 +01:00
Gunar Schorcht
409e609f46 cpu/esp32x: generate section.ld from section.ld.in
Using `sectoins.ld.in` instead of a static `sections.ld`, from which the actual used `sections.ld` is generated with the C preprocessor, allows to use the configuration in `sdkconfig.h` as well as Kconfig to use a custom section layout.
2022-12-31 15:30:34 +01:00
Gunar Schorcht
dc2dc801cc cpu/esp32x: generate memory.ld from vendor memory.ld.in
Using the vendor `memory.ld.in` instead of a static `memory.ld`, from which the actual used `memory.ld` is generated with the C preprocessor, allows to use the configuration in `sdkconfig.h` as well as Kconfig to use a custom memory layout. For example, it is no longer necessary to maintain different `memory.ld` files for the ESP32 BLE module, since the memory layout is now defined from the values of the configuration.
2022-12-31 15:30:34 +01:00
Gunar Schorcht
ce215f5be6 cpu/esp32: add BLE support in linker scripts for ESP32-S3 2022-08-26 21:16:09 +02:00
benpicco
5b6dff045a
Merge pull request #18510 from gschorcht/cpu/esp32/add_esp32c3_ble_support
cpu/esp32: enable BLE and NimBLE host support for ESP32-C3
2022-08-26 21:04:49 +02:00
benpicco
ffc657071e
Merge pull request #18509 from gschorcht/cpu/esp32/add_esp32s2_linker_scripts
cpu/esp32: add linker scripts for ESP32-S2
2022-08-24 21:41:53 +02:00
Gunar Schorcht
2ec9ca1276 cpu/esp32: add BLE support in linker scripts for ESP32-C3 2022-08-24 18:08:31 +02:00
Gunar Schorcht
e216a7d719 cpu/esp32: add linker scripts for ESP32-S2 2022-08-24 17:58:41 +02:00
Gunar Schorcht
48e7263674 cpu/esp32: add BLE support in linker scripts for ESP32 2022-08-24 09:03:38 +02:00
Gunar Schorcht
566bd333de cpu/esp32: add linker scripts for ESP32-S3
Add the linker script for ESP32-S3 and modify the ESP32-C3 linker scripts to be compatible with them. The goal is to use a section list of objects that is common for all ESP32x SoCs in future.
2022-08-07 13:13:11 +02:00
Gunar Schorcht
3c3bc1d4ce cpu/esp32: add linker scripts for ESP32-C3 2022-07-20 10:10:37 +02:00
Gunar Schorcht
257d4c3677 cpu/esp32: move linker scripts to a CPU family specific dir 2022-07-18 17:18:59 +02:00
Gunar Schorcht
ab14b68ea0 cpu/esp32: update of linker scripts for ESP-IDF v4.4 2022-06-01 13:21:29 +02:00
Gunar Schorcht
aecc516ce9 cpu/esp32: place freertos and periph in IRAM
The IRAM is much faster, while the IROM is much slower and can only be accessed via a cache, which is also sometimes disabled, e.g. by the WiFi module or when writing to the flash. Therefore, time-critical code as well as code that has to work even when the cache is disabled must be placed in the IRAM.
2021-10-30 14:46:57 +02:00
858b5ca6ed xfa: remove obsolete empty xfa.ld 2021-02-18 10:46:08 +01:00
2474fa7af5 cpu/esp32: add XFA support 2021-02-18 10:46:08 +01:00
Leandro Lanzieri
837ddf6d8c
cpu/esp32/ld: use folder name instead of archive for module objects 2020-10-09 13:29:51 +02:00
Gunar Schorcht
fb47f094d3 cpu/esp32: support multiple heaps for newlib
Several unsused DRAM sections are added to the heap.
2020-07-10 08:42:12 +02:00
benpicco
8e8cfbfe9c
Merge pull request #13516 from gschorcht/cpu/esp/fix_common_cpu_conf
cpu/esp_common: fixes common CPU configurations
2020-03-04 00:26:36 +01:00
Gunar Schorcht
8b61c40fc8 cpu/esp32: add .noinit section to linker script 2020-03-01 11:04:18 +01:00
Gunar Schorcht
b89b4e2259 cpu/esp32: place libc functions in IRAM 2020-03-01 10:55:52 +01:00
Gunar Schorcht
085eb3f40c cpu/esp32: place common CPU functions to IRAM 2020-03-01 10:55:52 +01:00
Gunar Schorcht
0d451969c3 cpu/esp32: place newlib syscalls in IRAM 2020-03-01 10:01:34 +01:00
Gunar Schorcht
5b4389cf46 cpu/esp32: update of ld script for littlefs*
During the write access to the SPI flash, the IROM cache is not available and only code from the IRAM can be executed. Therefore, the code of file system implementations which access the SPI flash must reside in IRAM.
2020-02-22 01:35:07 +01:00
Gunar Schorcht
95c6d1859c cpu/esp32: fix for crashes of tests/pkg_spiffs
ESP32 nodes can crash during SPI Flash write operations if required parts of the code are not in the IRAM but in the cached SPI Flash memory, which is disabled during the SPI Flash write operations. Therefore, the code of the SPIFFS package and the VFS module are now stored in the IRAM.
2019-12-06 11:44:15 +01:00
benpicco
63e4d8ffa5
Merge pull request #12803 from gschorcht/cpu/esp32/fix_little_fs
cpu/esp32: fix to be able to use SPI flash drive with pkg_littlefs
2019-11-25 15:49:13 +01:00
Gunar Schorcht
4fe35efe2b cpu/esp32: mtd has to be in IRAM to work correctly 2019-11-25 07:24:17 +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
Schorcht
3ac99877ac cpu: add esp32 2018-10-08 12:20:49 +02:00