What you have to do:
- Add at the end of the EBlink XML memory map the sector with the option base address and right length
- Give that sector a fake number e.g. 999 (something which is out of range of normal flash)
- Give that sector a virtual attribute to exclude it from the EBlink caching algorithm (property sectype = virtual)
- In the EBlink erase function filter on sector number 999 to skip normal flash erase function
- In the EBlink flash write function filter on sector number 999 and jump to a new to create function e.g. "option_write"
- Create new "option_write" function with the right algorithm to program option bytes
Check the script code for the stm32h7 which supports option programming. e.g. Memory map H7:
H7 erase function:
H7 write function:
H7 option_write:
Last but not least, if everything works: share it.
P.s. It's not much work but currently I'm a bit busy.
- Add at the end of the EBlink XML memory map the sector with the option base address and right length
- Give that sector a fake number e.g. 999 (something which is out of range of normal flash)
- Give that sector a virtual attribute to exclude it from the EBlink caching algorithm (property sectype = virtual)
- In the EBlink erase function filter on sector number 999 to skip normal flash erase function
- In the EBlink flash write function filter on sector number 999 and jump to a new to create function e.g. "option_write"
- Create new "option_write" function with the right algorithm to program option bytes
Check the script code for the stm32h7 which supports option programming. e.g. Memory map H7:
Code:
const mem_template_H7 = @@"
<?xml version=\"1.0\"?> <memory-map>
<snip...>
<!-- option byte area (virtual sector) -->
<memory type=\"flash\" start=\"0x1ff20000\" length=\"32\">
<property name=\"blocksize\">32</property>
<property name=\"secstart\">999</property>
<property name=\"sectype\">virtual</property>
</memory>
</memory-map>"
H7 erase function:
Code:
function flash_erase(sector, address)
{
local regbase = FLASH_REG_BASE_B0 // first flash bank
// Skip the virtual option sector
if(sector == 999)
return ERROR_OK
<snip...>
}
H7 write function:
Code:
function flash_write(sector, address, buffer)
{
local regbase = FLASH_REG_BASE_B0 // first flash bank
// If this is the virtual option sector, go to options write function
if(sector == 999)
return option_write(buffer)
<snip...>
}
H7 option_write:
Code:
function option_write(buffer)
{
<snip...>
}
Last but not least, if everything works: share it.
P.s. It's not much work but currently I'm a bit busy.