nihalpasham/rustBoot

Where are Peripherals, NVMC object placed ?

vietle77 opened this issue · 1 comments

Dear Nihal,
I am walking through class FlashWriterEraser in nrf52840.rs which should be refer for implementing a HAL of another board
I see there are 2 class Peripherals, NVMC (Non Volatile Memory Controller) which are not presented in the source dir.
So I guess these classes were generated from nrf52840.svd, right ?
if yes, kindly show me:
What tool is used to generate these class?
Where are generated classes placed ?

Thank you.
Viet

So, we're using the [nrf52840-hal](https://crates.io/crates/nrf52840-hal) (i.e. a crate maintained by the embedded rust community). It provides access (i.e. via abstractions) to all available system peripherals. The rust community maintains a number of different crates for different boards such as stm32, microchip-SAM etc.

nrf52840.svd - an .svd file (short for system view description) is actually not important. Its required for debugging i.e. there's
a VSCode plugin called cortex-m debug that is used to debug embedded code and it uses .svd files.

fyi - rust isn't exactly objected oriented. So, the concept of classes and instances of classes (i.e. objects) doesn't really exist, instead rust provides types and traits which can be used to write object-oriented code, data-oriented code (i.e. ECS type stuff) or code that conforms to other programming paradigms.