tock / libtock-rs

Rust userland library for Tock
Apache License 2.0
163 stars 109 forks source link

nRF52840 Invalid App RAM Start config #516

Open nguyenlkdn opened 1 year ago

nguyenlkdn commented 1 year ago

https://github.com/tock/libtock-rs/blob/master/build_scripts/src/lib.rs#L18 ("nrf52840" , "0x00030000", "0x00D0000", "0x20008000", "46K" ),

But in Kernel already used to >0x200081D4

> Initialization complete. Entering main loop
> NRF52 HW INFO: Variant: AAD0, Part: N52840, Package: QI, Ram: K256, Flash: K1024
> tock$ kernel
> Kernel version: 2.1 (build release-2.1-2012-g7ad7d1b4e)
> 
>  ╔═══════════╤══════════════════════════════╗
>  ║  Address  │ Region Name    Used (bytes)  ║
>  ╚0x200081D4═╪══════════════════════════════╝
>              │   BSS         25028
>   0x20002004 ┼─────────────────────────────── S
>              │   Relocate        4            R
>   0x20002000 ┼─────────────────────────────── A
>              │ ▼ Stack        8192            M
>   0x20000000 ┼───────────────────────────────
>              .....
>   0x0002E000 ┼─────────────────────────────── F
>              │   RoData      38992            L
>   0x000247B0 ┼─────────────────────────────── A
>              │   Code       149424            S
>   0x00000000 ┼─────────────────────────────── H

with above config, after installed leds sample application, it doens't work. after i changed build_scripts/src/lib.rs ("nrf52840" , "0x00030000", "0x00D0000", "0x20009000", "46K" ), It is able to work well.

So how can we know exactly OS(RAM, ROM) enough size for TockOS v2.1

bradjc commented 1 year ago

This is a definite pain point. You have the right fix to move the start of ram to a higher address.

Until we have suitable PIC support in LLVM there isn't much we can do. My temporary best alternative is in https://github.com/tock/libtock-rs/pull/509. We can compile for many candidate addresses and let tockloader decide which one to actually use.