Minor stm32f3/stm32f4 alignment
This commit is contained in:
parent
d10d47fe2e
commit
ed7d7fa868
3 changed files with 16 additions and 16 deletions
|
|
@ -138,6 +138,10 @@ bool board_app_valid(void)
|
|||
|
||||
void board_app_jump(void)
|
||||
{
|
||||
volatile uint32_t const * app_vector = (volatile uint32_t const*) BOARD_FLASH_APP_START;
|
||||
uint32_t sp = app_vector[0];
|
||||
uint32_t app_entry = app_vector[1];
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStruct;
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_12;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
|
|
@ -185,18 +189,14 @@ void board_app_jump(void)
|
|||
NVIC->ICER[2] = 0xFFFFFFFF;
|
||||
NVIC->ICER[3] = 0xFFFFFFFF;
|
||||
|
||||
// TODO protect bootloader region
|
||||
|
||||
volatile uint32_t const * app_vector = (volatile uint32_t const*) BOARD_FLASH_APP_START;
|
||||
|
||||
/* switch exception handlers to the application */
|
||||
SCB->VTOR = (uint32_t) BOARD_FLASH_APP_START;
|
||||
|
||||
// Set stack pointer
|
||||
__set_MSP(app_vector[0]);
|
||||
__set_MSP(sp);
|
||||
|
||||
// Jump to Application Entry
|
||||
asm("bx %0" ::"r"(app_vector[1]));
|
||||
asm("bx %0" ::"r"(app_entry));
|
||||
}
|
||||
|
||||
uint8_t board_usb_get_serial(uint8_t serial_id[16])
|
||||
|
|
|
|||
|
|
@ -29,13 +29,9 @@
|
|||
#endif
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
//
|
||||
// MACRO TYPEDEF CONSTANT ENUM
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
// no caching
|
||||
//#define FLASH_CACHE_SIZE 4096
|
||||
//#define FLASH_CACHE_INVALID_ADDR 0xffffffff
|
||||
|
||||
#define FLASH_BASE_ADDR 0x08000000UL
|
||||
|
||||
// TinyUF2 resides in the first 2 flash sectors on STM32F4s, therefore these are write protected
|
||||
|
|
@ -84,9 +80,14 @@ enum
|
|||
static uint8_t erased_sectors[SECTOR_COUNT] = { 0 };
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
//
|
||||
// Internal Helper
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
static inline uint32_t flash_sector_size(uint32_t sector)
|
||||
{
|
||||
return sector_size[sector];
|
||||
}
|
||||
|
||||
static bool is_blank(uint32_t addr, uint32_t size)
|
||||
{
|
||||
for ( uint32_t i = 0; i < size; i += sizeof(uint32_t) )
|
||||
|
|
@ -112,7 +113,7 @@ static bool flash_erase(uint32_t addr)
|
|||
{
|
||||
TUF2_ASSERT(sector_addr < FLASH_BASE_ADDR + BOARD_FLASH_SIZE);
|
||||
|
||||
size = sector_size[i];
|
||||
size = flash_sector_size(i);
|
||||
if ( sector_addr + size > addr )
|
||||
{
|
||||
sector = i;
|
||||
|
|
@ -170,7 +171,7 @@ static void flash_write(uint32_t dst, const uint8_t *src, int len)
|
|||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
//
|
||||
// Board API
|
||||
//--------------------------------------------------------------------+
|
||||
void board_flash_init(void)
|
||||
{
|
||||
|
|
@ -285,7 +286,7 @@ void board_self_update(const uint8_t * bootloader_bin, uint32_t bootloader_len)
|
|||
|
||||
for ( uint32_t i = 0; i < 4 && len > 0; i++ )
|
||||
{
|
||||
uint32_t const size = (sector_size[i] < len ? sector_size[i] : len);
|
||||
uint32_t const size = (flash_sector_size(i) < len ? flash_sector_size(i) : len);
|
||||
board_flash_write(sector_addr, data, size);
|
||||
|
||||
sector_addr += size;
|
||||
|
|
|
|||
|
|
@ -364,7 +364,6 @@ void SysTick_Handler(void)
|
|||
board_timer_handler();
|
||||
}
|
||||
|
||||
|
||||
int board_uart_write(void const * buf, int len)
|
||||
{
|
||||
#if defined(UART_DEV) && CFG_TUSB_DEBUG
|
||||
|
|
|
|||
Loading…
Reference in a new issue