Macros | Functions
flash_helper.c File Reference
#include "flash_helper.h"
#include "ch.h"
#include "hal.h"
#include "stm32f4xx_conf.h"
#include "utils.h"
#include "mcpwm.h"
#include "hw.h"
#include <string.h>

Macros

#define FLASH_SECTORS   12
 
#define BOOTLOADER_BASE   11
 
#define APP_BASE   0
 
#define NEW_APP_BASE   8
 
#define NEW_APP_SECTORS   3
 
#define ADDR_FLASH_SECTOR_0   ((uint32_t)0x08000000)
 
#define ADDR_FLASH_SECTOR_1   ((uint32_t)0x08004000)
 
#define ADDR_FLASH_SECTOR_2   ((uint32_t)0x08008000)
 
#define ADDR_FLASH_SECTOR_3   ((uint32_t)0x0800C000)
 
#define ADDR_FLASH_SECTOR_4   ((uint32_t)0x08010000)
 
#define ADDR_FLASH_SECTOR_5   ((uint32_t)0x08020000)
 
#define ADDR_FLASH_SECTOR_6   ((uint32_t)0x08040000)
 
#define ADDR_FLASH_SECTOR_7   ((uint32_t)0x08060000)
 
#define ADDR_FLASH_SECTOR_8   ((uint32_t)0x08080000)
 
#define ADDR_FLASH_SECTOR_9   ((uint32_t)0x080A0000)
 
#define ADDR_FLASH_SECTOR_10   ((uint32_t)0x080C0000)
 
#define ADDR_FLASH_SECTOR_11   ((uint32_t)0x080E0000)
 

Functions

uint16_t flash_helper_erase_new_app (uint32_t new_app_size)
 
uint16_t flash_helper_write_new_app_data (uint32_t offset, uint8_t *data, uint32_t len)
 
void flash_helper_jump_to_bootloader (void)
 

Macro Definition Documentation

#define ADDR_FLASH_SECTOR_0   ((uint32_t)0x08000000)
#define ADDR_FLASH_SECTOR_1   ((uint32_t)0x08004000)
#define ADDR_FLASH_SECTOR_10   ((uint32_t)0x080C0000)
#define ADDR_FLASH_SECTOR_11   ((uint32_t)0x080E0000)
#define ADDR_FLASH_SECTOR_2   ((uint32_t)0x08008000)
#define ADDR_FLASH_SECTOR_3   ((uint32_t)0x0800C000)
#define ADDR_FLASH_SECTOR_4   ((uint32_t)0x08010000)
#define ADDR_FLASH_SECTOR_5   ((uint32_t)0x08020000)
#define ADDR_FLASH_SECTOR_6   ((uint32_t)0x08040000)
#define ADDR_FLASH_SECTOR_7   ((uint32_t)0x08060000)
#define ADDR_FLASH_SECTOR_8   ((uint32_t)0x08080000)
#define ADDR_FLASH_SECTOR_9   ((uint32_t)0x080A0000)
#define APP_BASE   0
#define BOOTLOADER_BASE   11
#define FLASH_SECTORS   12
#define NEW_APP_BASE   8
#define NEW_APP_SECTORS   3

Function Documentation

uint16_t flash_helper_erase_new_app ( uint32_t  new_app_size)
void flash_helper_jump_to_bootloader ( void  )

Stop the system and jump to the bootloader.

uint16_t flash_helper_write_new_app_data ( uint32_t  offset,
uint8_t *  data,
uint32_t  len 
)