Class Firmware
Defined in File sim_firmware.h
Nested Relationships
Nested Types
Class Documentation
-
class Firmware
Firmware contains the information of a firmware loaded from a ELF file. A firmware consists of blocks of binary data that can be loaded into the various non-volatile memory areas of a MCU. Each memory area can have several blocks of data (e.g. flash has .text, .rodata, …) placed at different addresses, not necessarily contiguous. The currently supported memory areas :
area name
ELF section(s)
LMA origin
Flash
.text, .data, .rodata
0x000000
EEPROM
.eeprom
0x810000
Fuses
.fuse
0x820000
Lock
.lock
0x830000
Signature
.signature
0x840000
UserSignatures
.user_signatures
0x850000
Note
The area in which a section is loaded depends on the LMA, not the section name.
Public Types
Public Functions
-
Firmware()
Build a empty firmware
-
~Firmware()
Destroy a firmware
-
void add_block(Area area, const Block &block)
Add a binary block to the firmware
Note
A deep copy of the binary data is made
- Parameters:
area – NVM area to which the block should be added
block – binary data block to be added
-
bool has_memory(Area area) const
Get whether the firmware has binary data for a given NVM area.
- Parameters:
area – NVM area to check
- Returns:
true if the NVM area has data, false otherwise
-
std::vector<Area> memories() const
Return the list of NVM areas for which the firmware has binary data.
-
size_t memory_size(Area area) const
Get the total size of binary data loaded for a given NVM area.
- Parameters:
area – NVM area to check
- Returns:
the total size of data in bytes
-
std::vector<Block> blocks(Area area) const
Get the binary blocks loaded for a given NVM area.
- Parameters:
area – NVM area to check
- Returns:
the binary data blocks loaded for this area, may be empty.
-
bool load_memory(Area area, NonVolatileMemory &memory) const
Copy the binary blocks loaded for a given NVM area into a NVM model.
- Parameters:
area – NVM area to retrieve
memory – NVM model where the data should be copied
- Returns:
true if the binary data could be copied, false if it failed
-
inline mem_addr_t datasize() const
-
inline mem_addr_t bsssize() const
Public Members
-
unsigned long frequency
Main clock frequency in hertz, mandatory to run the simulation.
-
double vcc
Power supply voltage in volts. If not set, analog peripherals such as ADC are not usable.
-
double aref
Analog reference voltage in volts.
-
reg_addr_t console_register
I/O register address used for console output.
Public Static Functions
-
struct Block : public mem_block_t
Public Members
-
size_t base = 0
-
size_t base = 0
-
struct Symbol
-
Firmware()