65 for(
unsigned int i = 0; i < (
pageSize * 2); i++)
121 unsigned int pc =
core->
PC;
126 addr = (addr & 0xffff) + (xaddr << 16);
140 addr = addr & 0xfffe;
168 for(
unsigned int i = 0; i < (
pageSize * 2); i++)
235 fuseBits(0xfffffffd),
260 for(
int i = (fSize - 1); i >= 0; --i) {
FlashProgramming(AvrDevice *c, unsigned int pgsz, unsigned int nrww, int mode)
Create a instance of FlashProgramming class.
Basic AVR device, contains the core functionality.
void AddToCycleList(Hardware *hw)
unsigned char spmcr_opr_bits
mask for operation bits, including SPMEN bit
unsigned char * tempBuffer
hidden buffer for flash page operations
SystemClockOffset GetCurrentTime() const
Returns the current simulation time.
int lockBitsSize
count of lock bits
void avr_free(void *ptr)
Free malloc'd memory.
void WriteMem(const unsigned char *src, unsigned int addr, unsigned int secSize)
bool isATMega
Flag: true, if in ATMega mode, if false, it's ATTiny mode.
int valueBOOTSZ
value of BOOTSZ fuse bits
int bitPosBOOTRST
bit position BOOTRST fuses (1 Bit) in fuseBits
unsigned char spmcr_valid_bits
mask for valid bits
bool flagBOOTRST
value of BOOTRST fuse bit
unsigned char LPM_action(unsigned int xaddr, unsigned int addr)
void SetFuseConfiguration(int size, unsigned long defvalue)
Configure fuses.
unsigned char lockBits
lock bits data
void SetLockBits(unsigned char bits)
Set lock bits (from a SPM instruction)
unsigned int GetBLSStart(void)
Get start address of bootloader section.
bool LoadLockBits(const unsigned char *buffer, int size)
Initialize lock bits from elf, checks proper size.
SystemClockOffset timeout
system time till operation run
int opr_enable_count
enable counter for SPM operation
unsigned char spmcr_val
holds the register value
SPM_OPStype spm_opr
selected SPM operation
void SetRWWLock(unsigned int addr)
static SystemClock & Instance()
Returns the central SystemClock instance for the application.
SPM_ACTIONtype action
state of the processing engine
void ClearOperationBits(void)
unsigned int GetResetAddr(void)
Get reset address.
void SetLockBitsConfiguration(int size)
Configure lock bits.
#define avr_new(type, count)
Macro for allocating memory.
unsigned int nrwwSize
size of NRWW section in byte
void SetRWWLock(unsigned int addr)
void SetSpmcr(unsigned char v)
int bitPosBOOTSZ
bit position BOOTSZ fuses (2 Bit) in fuseBits
Provides the programming engine for flash self programming.
void SetBootloaderConfig(unsigned addr, int size, int bPosBOOTSZ, int bPosBOOTRST)
Set bootloader support configuration.
int SPM_action(unsigned int data, unsigned int xaddr, unsigned int addr)
unsigned int pageSize
page size in words
unsigned int nrwwAddr
start address NRWW section
unsigned int nrww_addr
start address of non RWW area of flash (word address)
bool LoadFuses(const unsigned char *buffer, int size)
Initialize fuses from elf, checks proper size.
int fuseBitsSize
count of bits in fuses
AvrDevice * core
link to AvrDevice
unsigned long fuseBits
fuse data
IOReg< FlashProgramming > spmcr_reg