Commit Graph

28 Commits

Author SHA1 Message Date
Björn Quentin
92bda00296
Remove heap related symbols, use all remaining memory for the stack (#716)
* Use all remaining memory for stack(s)

* Remove HEAP related code from RISCV linker scripts

* Fix direct-boot / mcu-boot linker scripts

* Use a statically allocated stack for core-1
2023-08-14 13:38:36 +02:00
Scott Mabin
f1fce08a94
Move segment aliasing to linkall.x (#655)
* Move segment aliasing to linkall.x, this allows other projects to define there own alias whilst still being able to use esp-hal linker scripts

* Move rwtext in front of rwdata

* Re-arrange include

* Fix s3 direct boot script
2023-07-18 07:17:52 -07:00
Jordan Halase
a562863cde
Add MD5 functionality from ESP ROM (#618)
* Add ROM MD5 definitions in linker and devices

* Add initial MD5 support

* Implement traits and add comments to MD5 module

* Add MD5 example to ESP32-C3

* Test MD5 context on the quick brown fox

* Implemenr From<Context> for Digest

* Add MD5 to the rest of the examples

* Add docs for MD5

* Remove #[repr(transparent)] from md5::Digest

* Update CHANGELOG.md
2023-06-26 09:01:34 +02:00
Scott Mabin
087bfa570b
Fix insertion location of trap section in ram (#605)
* Fix insertion location of trap section in ram

* Apply fixes for db and mcuboot

* Add changelog
2023-06-23 12:00:16 +01:00
Jordan Halase
f22cd7370d
Add CRC functionality from ESP ROM (#587)
* Add ESP ROM CRC and fallbacks to HAL

* Cargo fmt

* Add CRC examples

* Cargo fmt

* Cargo fmt and clippy (all)

* Update CHANGELOG.md
2023-06-14 05:40:51 -07:00
sethp
171e66e87a
feat(riscv): relocate .trap machinery to RAM (#541)
* feat: relocate riscv isr to iram

Previously, the trap vector itself and its immediate callees
(`_start_trap` and `_start_trap_rust_hal`) were located in the mapped
instruction flash range `0x420..`, increasing cache pressure and adding
variable latency to the very beginning of the interrupt/exception
service flow.

This change places those routines in iram directly:

```
   Num:    Value  Size Type    Bind   Vis      Ndx Name
 48177: 40380280  2428 FUNC    GLOBAL DEFAULT    6 _start_trap_rust_hal
 48197: 40380bfc    54 FUNC    GLOBAL DEFAULT    6 _start_trap_rust
 48265: 40380200     0 FUNC    GLOBAL DEFAULT    6 _vector_table
 48349: 40380100     0 NOTYPE  GLOBAL DEFAULT    6 default_start_trap
 48350: 40380100     0 NOTYPE  GLOBAL DEFAULT    6 _start_trap
```

As seen via `readelf -W -s -C ./target/riscv32imc-unknown-none-elf/debug/examples/gpio_interrupt | grep -E _start_trap\|_vector\|Ndx`

* feat(riscv): place .trap in RAM

This change follows through on relocating the `_vector_table`,
`_start_trap`, and `_start_trap_rust` functions for all present
build/link modes for the 'c2, 'c3, 'c6, and 'h2.

It has been tested by running the `software_interrupts` example for the
'c3 in direct-boot and esp-bootloader contexts, but I wasn't able to
identify how to run the `mcu-boot` mode for the 'c3, nor do I have
present access to any of the other devices for testing.

* docs: Update CHANGELOG.md
2023-05-26 20:48:49 +01:00
bjoernQ
01f35245f8 Fix 802.15.4 clock enabling (ESP32-C6) 2023-03-28 13:41:21 +02:00
Juraj Sadel
0244c6d6fc
Feature/reset functionalities (#452)
* add `software_reset`, `software_reset_cpu` and `rtc_get_wakeup_cause`

* Add SOC wakeup symbols

* Add SleepSource and WakeupReason enums and get_wakeup_cause() function

* Add other SOC wakeups

* fixups and fmt

* address review comments

* Update symbols in WakeupReason enum

* fmt

---------

Co-authored-by: Anthony Grondin <104731965+AnthonyGrondin@users.noreply.github.com>
2023-03-24 20:37:24 +01:00
Scott Mabin
0b02619e37 esp32c3/c2: use rwtext.wifi in dummy section calculation 2023-03-23 12:45:30 +00:00
Scott Mabin
9a5a546228
Unify linker scripts (#443)
* esp32 & esp32s2 sharing scripts

* add wokwi files

* Add fixup section for esp32s2, fix ordering of sectino includes

* Remove debug asm file

* Use shared linker scripts for s3 with fixups

* Add external.x sections back

* Move ld scripts into esp-hal-common

* esp32c3 unified linker scripts

- rework original c3 script to use the xtensa named sections
  (e.g, _SECTIONNAME_start)
- Add fixups in esp32c3 specific linker
- Remove useless text section start and end (not required when using any
  form of bootloader)

* Add RTC alias'. Move some shared fixups to a file

* comment and cleanup

* unify c2 linker script

* unify c6 linker script

* remove debug configs

* use new esp-riscv-rt

* fmt

* align db symbol names

* fix s3 db
2023-03-20 08:12:14 -07:00
bjoernQ
5b2729b75d Remove r0 dependency 2023-03-14 08:27:43 -07:00
Jesse Braham
f7830e2750
Reduce duplication, simplify re-exports, and general cleanup/organization (#424)
* Move some linker scripts into `esp-hal-common` and update the build script

* Move `EspDefaultHandler` and `DefaultHandler` definitions into `esp-hal-common`

* Re-export everything from `esp-hal-common`

* Add a couple cfg symbols, cleanup/organize some exports/modules
2023-03-08 06:35:59 -08:00
Gustavo Henrique Nihei
453a7ac3f0
[ESP32-C3] Restore MCUboot build after moving to esp-riscv-rt (#417)
* esp32c3-hal: Fix operations on EXTMEM peripheral

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>

* esp32c3-hal: Restore MCUboot build after moving to esp-riscv-rt

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>

* esp32c3-hal: Fix location of .data linker output section

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>

* ci: Enable MCUboot build for ESP32-C3

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>

---------

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2023-03-01 14:10:35 +00:00
Björn Quentin
0b9ebbcc79
Fix direct boot linker script for ESP32-C2/C3 (#396) 2023-02-20 13:40:12 +00:00
Jesse Braham
cf270700e7
Use the new esp-riscv-rt package for RISC-V HALs (#365)
* Update PACs and modify `esp-hal-common` to use new `esp-riscv-rt` package

* Update `esp32c2-hal` and `esp32c3-hal` to use `esp-riscv-rt` as well

* Update all RISC-V examples to use `esp-riscv-rt`

* Update RISC-V trap frame handling according to review feedback
2023-01-27 10:49:38 -08:00
Jesse Braham
832f9ef4d4
Refactor the clock module, provide ROM functions via linker scripts (#353)
* Refactor `clock` and `clocks_ll` into a common module

* Add a ROM function linker script to each HAL and provide some functions

* Use the provided ROM functions instead of transmuting addresses

* Fix CI workflow for ESP32-S2
2023-01-23 07:12:33 -08:00
bjoernQ
cb41b9553b Avoid possible linker error 2022-11-21 07:01:50 -08:00
9names
0f803d07cd Add uninit section to bl and mv linker scripts to match db 2022-11-03 19:37:00 +11:00
Gustavo Henrique Nihei
5cca83ca51 esp32c3: Set entry point address on MCUboot image header
Previously it assumed that the entry point was allocated at the
beginning of the ".rwtext" output section, which is not always true.

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2022-10-24 09:52:46 -03:00
Gustavo Henrique Nihei
5b6c52c02c esp32c3: Add support for booting from MCUboot bootloader
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2022-10-24 09:37:52 -03:00
9names
c896e6c8d2 Fixed defmt on direct-boot mode 2022-09-07 06:20:24 +02:00
Gustavo Henrique Nihei
3cbabe3247
ESP32[-C3]: Fix broken references in documentation (#153)
* esp32c3: Fix broken references to esptool repository

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>

* esp32: Fix broken reference to esp-idf repository

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2022-08-16 08:32:47 -07:00
bjoernQ
49841c295d Fix ESP32-C3 builds on latest nightlies 2022-08-16 09:42:36 +02:00
Scott Mabin
99ae152f55 Fix bss section placement in db mode
If bss contained anything a linker error was emitted about overlapping
sections. Moving the .bss section to after the .rwtext, and adding a dummy
section to pad data bus access to the bss section fixes this.
2022-08-09 23:51:28 +01:00
Scott Mabin
1d02bf87c3
RISCV vectored interrupts (#118)
* RISCV interrupt vectoring

- Adds support for vectoring peripheral interrupts to PAC handlers
- Currently supports level interrupts with priorities from 1-15
- Updated the gpio interrupt example to reflect the new changes

* remove .vscode files

* Support vectored edge interrupts

This is as simple as making sure we clear the CPU interrupt whenever we
receive one. This also documents further what APIs are safe to call when
the `vectored` feature is enabled.

* fix all examples to use vectoring

* doc & cleanup

* run handlers from ram

* make xtensa::interrupt::vectored private, we rexport public items

* fix default handlers

* pass interrupt into EspDefaultHandler
2022-07-26 09:24:47 -07:00
bjoernQ
033824391d Add linker script entries needed for wifi drivers on ESP32C3 2022-04-12 09:25:23 -07:00
bjoernQ
e7ad8ce7a1 Depend on the published riscv-rt 2022-02-24 15:40:41 +00:00
bjoernQ
7b59c9e76d Move linker scripts to sub-folders 2022-02-18 12:00:05 +01:00