|
REDAC HybridController
Firmware for LUCIDAC/REDAC Teensy
|
#include <Arduino.h>#include <malloc.h>#include <stdint.h>#include <string.h>#include <ota/flasher.h>#include <utils/etl_base64.h>#include <utils/logging.h>#include <utils/reboot.h>
Go to the source code of this file.
Macros | |
| #define | FLASH_ID "fw_teensy41" |
| #define | FLASH_ID_LEN (11) |
| #define | FLASH_SIZE (0x800000) |
| #define | FLASH_SECTOR_SIZE (0x1000) |
| #define | FLASH_WRITE_SIZE (4) |
| #define | FLASH_RESERVE (80 * FLASH_SECTOR_SIZE) |
| #define | FLASH_BASE_ADDR (0x60000000) |
| #define | IN_FLASH(a) |
| #define | CPU_RESTART_ADDR ((uint32_t *)0xE000ED0C) |
| #define | CPU_RESTART_VAL (0x5FA0004) |
| #define | REBOOT (*CPU_RESTART_ADDR = CPU_RESTART_VAL) |
| #define | RAMFUNC __attribute__((section(".fastrun"), noinline, noclone, optimize("Os"))) |
| #define | return_err(code, msg) |
| #define | return_errf(code, msg, ...) |
| #define | RETURN_IF_FLASHING_NOT_ENABLED return_err(0, "OTA Flashing is disabled in this firmware build") |
Functions | |
| __attribute__ ((section(".fastrun"), noinline, noclone, optimize("Os"))) int flash_sector_not_erased(uint32_t address) | |
| void | eepromemu_flash_write (void *addr, const void *data, uint32_t len) |
| void | eepromemu_flash_erase_sector (void *addr) |
| void | eepromemu_flash_erase_32K_block (void *addr) |
| void | eepromemu_flash_erase_64K_block (void *addr) |
| void | firmware_buffer_free (uint32_t buffer_addr, uint32_t buffer_size) |
| int | flash_write_block (uint32_t addr, char *data, uint32_t count) |
| int | flash_erase_block (uint32_t address, uint32_t size) |
| void | firmware_buffer_init (uint32_t *buffer_addr, uint32_t *buffer_size) |
| while (offset< size &&error==0) | |
| if (((src) >=(0x60000000) &&(src)<(0x60000000)+(0x800000))) | |
| for (;;) | |
| int | flash_write_block (uint32_t addr, uint8_t *data, uint32_t count) |
Variables | |
| uint32_t | src |
| uint32_t uint32_t | size |
| static int | leave_interrupts_disabled = 0 |
| uint32_t = (0x5FA0004) ) | |
| static constexpr int | success = 0 |
| constexpr static size_t | json_overhead = 0xff |
| constexpr static size_t | base64_chunk_size = 4096 / 2 |
| constexpr static size_t | bin_chunk_size = base64_chunk_size * 3 / 4 |
Macro Definition Documentation
◆ CPU_RESTART_ADDR
| #define CPU_RESTART_ADDR ((uint32_t *)0xE000ED0C) |
Definition at line 44 of file flasher.cpp.
◆ CPU_RESTART_VAL
| #define CPU_RESTART_VAL (0x5FA0004) |
Definition at line 45 of file flasher.cpp.
◆ FLASH_BASE_ADDR
| #define FLASH_BASE_ADDR (0x60000000) |
Definition at line 39 of file flasher.cpp.
Referenced by firmware_buffer_init().
◆ FLASH_ID
| #define FLASH_ID "fw_teensy41" |
Definition at line 31 of file flasher.cpp.
◆ FLASH_ID_LEN
| #define FLASH_ID_LEN (11) |
Definition at line 32 of file flasher.cpp.
◆ FLASH_RESERVE
| #define FLASH_RESERVE (80 * FLASH_SECTOR_SIZE) |
Definition at line 38 of file flasher.cpp.
Referenced by firmware_buffer_init(), and if().
◆ FLASH_SECTOR_SIZE
| #define FLASH_SECTOR_SIZE (0x1000) |
Definition at line 34 of file flasher.cpp.
Referenced by __attribute__(), firmware_buffer_init(), flash_erase_block(), if(), and while().
◆ FLASH_SIZE
| #define FLASH_SIZE (0x800000) |
Definition at line 33 of file flasher.cpp.
Referenced by firmware_buffer_init(), and if().
◆ FLASH_WRITE_SIZE
| #define FLASH_WRITE_SIZE (4) |
Definition at line 35 of file flasher.cpp.
Referenced by flash_write_block(), if(), and while().
◆ IN_FLASH
| #define IN_FLASH | ( | a | ) |
◆ RAMFUNC
| #define RAMFUNC __attribute__((section(".fastrun"), noinline, noclone, optimize("Os"))) |
Definition at line 50 of file flasher.cpp.
Referenced by __attribute__().
◆ REBOOT
| #define REBOOT (*CPU_RESTART_ADDR = CPU_RESTART_VAL) |
Definition at line 46 of file flasher.cpp.
◆ return_err
| #define return_err | ( | code, | |
| msg ) |
Definition at line 276 of file flasher.cpp.
◆ return_errf
| #define return_errf | ( | code, | |
| msg, | |||
| ... ) |
Definition at line 281 of file flasher.cpp.
◆ RETURN_IF_FLASHING_NOT_ENABLED
| #define RETURN_IF_FLASHING_NOT_ENABLED return_err(0, "OTA Flashing is disabled in this firmware build") |
Definition at line 304 of file flasher.cpp.
Function Documentation
◆ __attribute__()
| __attribute__ | ( | (section(".fastrun"), noinline, noclone, optimize("Os")) | ) |
Definition at line 114 of file flasher.cpp.
References FLASH_SECTOR_SIZE, RAMFUNC, and uint32_t.
Referenced by flash_write_block().
◆ eepromemu_flash_erase_32K_block()
| void eepromemu_flash_erase_32K_block | ( | void * | addr | ) |
◆ eepromemu_flash_erase_64K_block()
| void eepromemu_flash_erase_64K_block | ( | void * | addr | ) |
◆ eepromemu_flash_erase_sector()
| void eepromemu_flash_erase_sector | ( | void * | addr | ) |
Referenced by flash_erase_block(), if(), and while().
◆ eepromemu_flash_write()
| void eepromemu_flash_write | ( | void * | addr, |
| const void * | data, | ||
| uint32_t | len ) |
References uint32_t.
Referenced by flash_write_block(), and while().
◆ firmware_buffer_free()
Definition at line 107 of file flasher.cpp.
References flash_erase_block(), and uint32_t.
◆ firmware_buffer_init()
Definition at line 75 of file flasher.cpp.
References FLASH_BASE_ADDR, FLASH_RESERVE, FLASH_SECTOR_SIZE, FLASH_SIZE, and uint32_t.
◆ flash_erase_block()
Definition at line 204 of file flasher.cpp.
References eepromemu_flash_erase_sector(), FLASH_SECTOR_SIZE, size, and uint32_t.
Referenced by firmware_buffer_free().
◆ flash_write_block() [1/2]
◆ flash_write_block() [2/2]
Definition at line 225 of file flasher.cpp.
References __attribute__(), eepromemu_flash_write(), FLASH_WRITE_SIZE, IN_FLASH, and uint32_t.
◆ for()
| for | ( | ;; | ) |
Definition at line 197 of file flasher.cpp.
◆ if()
Definition at line 177 of file flasher.cpp.
References eepromemu_flash_erase_sector(), FLASH_RESERVE, FLASH_SECTOR_SIZE, FLASH_SIZE, FLASH_WRITE_SIZE, and src.
◆ while()
| while | ( | ) |
Definition at line 135 of file flasher.cpp.
References eepromemu_flash_erase_sector(), eepromemu_flash_write(), FLASH_SECTOR_SIZE, FLASH_WRITE_SIZE, size, src, and uint32_t.
Variable Documentation
◆ base64_chunk_size
|
staticconstexpr |
Definition at line 294 of file flasher.cpp.
◆ bin_chunk_size
|
staticconstexpr |
Definition at line 295 of file flasher.cpp.
◆ json_overhead
|
staticconstexpr |
Definition at line 293 of file flasher.cpp.
◆ leave_interrupts_disabled
|
static |
Definition at line 70 of file flasher.cpp.
◆ size
Definition at line 63 of file flasher.cpp.
Referenced by utils::dcp_hash_update(), utils::dcp_hash_update_non_blocking(), flash_erase_block(), flash_write_block(), net::NativeEthernetClientHAL::read(), net::TeensyEthernetClientHAL::read(), shortened_hexdump(), while(), net::NativeEthernetClientHAL::write(), net::NativeEthernetServerHAL::write(), net::NativeEthernetUDP::write(), net::TeensyEthernetClientHAL::write(), net::TeensyEthernetServerHAL::write(), net::TeensyEthernetUDP::write(), net::NativeEthernetClientHAL::writeFully(), net::NativeEthernetClientHAL::writeFully(), net::TeensyEthernetClientHAL::writeFully(), net::TeensyEthernetClientHAL::writeFully(), and net::TeensyEthernetClientHAL::~TeensyEthernetClientHAL().
◆ src
| uint32_t src |
Definition at line 63 of file flasher.cpp.
Referenced by utils::dcp_reverse_and_copy(), if(), and while().
◆ success
|
staticconstexpr |
Definition at line 275 of file flasher.cpp.
Referenced by blocks::MIntBlock_V_1_1_X::_gain_calibration(), blocks::MIntBlock_V_1_1_X::calibrate(), blocks::MMulBlock_FullAutoCalibration::calibrate(), run::run_flexio_raw(), platform::REDAC_HAL_V_1_1_X::write_fp_control_register(), blocks::TBlockBackplaneHAL_V_1_0_X::write_muxes(), and blocks::TBlockHAL_V_1_0_X::write_muxes().
◆ uint32_t
| uint32_t = (0x5FA0004) ) |
Definition at line 177 of file flasher.cpp.
Referenced by __attribute__(), net::NativeEthernetUDP::beginPacket(), utils::ch(), blocks::DummySHBlockHAL::compensate_hardware_offsets(), utils::dcp_clear_channel_status(), utils::dcp_clear_status(), utils::dcp_get_channel_status(), utils::dcp_hash_process_message_data(), utils::dcp_hash_update(), utils::dcp_hash_update_non_blocking(), utils::dcp_schedule_work(), utils::DCP_WaitForChannelComplete(), utils::demo_crc32(), utils::demo_sha256(), eepromemu_flash_write(), firmware_buffer_free(), firmware_buffer_init(), flash_erase_block(), flash_write_block(), flash_write_block(), platform::get_ip_of_external_device(), kind2key(), utils::maj(), functions::EEPROM25AA02::read32(), websockets::internals::readData(), websockets::internals::readUntilSuccessfullOrError(), utils::rotr(), serve_static(), platform::set_ip_of_external_device(), utils::sigma0(), utils::sigma1(), websockets::internals::swapEndianess(), websockets::internals::swapEndianess(), functions::DataFunction::transfer32(), functions::SR74HCT595::transfer32(), functions::TriggerFunction::trigger(), while(), functions::EEPROM25AA02::write32(), functions::AD9834::write_frequency(), and blocks::IBlockHAL_V_1_2_X::write_outputs().