#[repr(u8)]pub enum SectionType {
DTCM = 128,
ITCM = 129,
SRAM = 130,
PSRAM = 131,
LPDDR = 132,
XIP = 133,
}
Expand description
Enum representing different section types in memory.
This enum defines the types of memory sections that can exist, each represented by a specific identifier (u8 value). These sections correspond to various types of memory regions, such as data cache memory (DTCM), instruction cache memory (ITCM), and other specialized memory regions.
§Variants
DTCM
: Data tightly coupled memory (0x80).ITCM
: Instruction tightly coupled memory (0x81).SRAM
: Static RAM (0x82).PSRAM
: Pseudo-static RAM (0x83).LPDDR
: Low power DDR memory (0x84).XIP
: Execute-In-Place memory (0x85), containing raw binary with compiled code.
The XIP
variant refers to memory regions that can execute code directly from the memory,
without the need to copy the code into RAM.
§Example
use amebazii::types::enums::SectionType;
let section = SectionType::try_from(0x80).unwrap();
assert_eq!(section, SectionType::DTCM); // Successfully converts to DTCM.
§Error Handling
If the provided value doesn’t correspond to a known section type, an error
(Error::UnknownSectionType
) will be returned.
Variants§
DTCM = 128
ITCM = 129
SRAM = 130
PSRAM = 131
LPDDR = 132
XIP = 133
Execute-In-Place (XIP) contains the raw binary with all compiled code.
Trait Implementations§
Source§impl Clone for SectionType
impl Clone for SectionType
Source§fn clone(&self) -> SectionType
fn clone(&self) -> SectionType
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for SectionType
impl Debug for SectionType
Source§impl<'de> Deserialize<'de> for SectionType
impl<'de> Deserialize<'de> for SectionType
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Ord for SectionType
impl Ord for SectionType
Source§fn cmp(&self, other: &SectionType) -> Ordering
fn cmp(&self, other: &SectionType) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for SectionType
impl PartialEq for SectionType
Source§impl PartialOrd for SectionType
impl PartialOrd for SectionType
Source§impl Serialize for SectionType
impl Serialize for SectionType
Source§impl TryFrom<u8> for SectionType
impl TryFrom<u8> for SectionType
Source§fn try_from(value: u8) -> Result<Self, Self::Error>
fn try_from(value: u8) -> Result<Self, Self::Error>
Tries to convert a u8
value into a corresponding SectionType
variant.
This function maps a u8
value to its corresponding SectionType
enum variant.
If the value does not match a valid section type, it returns an error with
the message indicating an invalid section type.
§Parameters
value
: Theu8
value representing the section type.
§Returns
SectionType
: A validSectionType
variant if the value matches.Error::UnknownSectionType
: An error if the value doesn’t match a known section type.
§Example
use amebazii::types::enums::SectionType;
let section = SectionType::try_from(0x84).unwrap();
assert_eq!(section, SectionType::LPDDR); // Successfully converts to LPDDR.