From 4890ef3ab0a040e7a772f2d43ec125091019b539 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Sun, 7 Sep 2014 22:42:20 +0200 Subject: [PATCH] OP-1477 - Add support for Flash --- flight/targets/boards/gpsplatinum/board_hw_defs.c | 4 ++++ flight/targets/boards/gpsplatinum/firmware/Makefile | 1 + .../boards/gpsplatinum/firmware/inc/pios_config.h | 2 +- flight/targets/boards/gpsplatinum/firmware/pios_board.c | 9 ++++++--- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/flight/targets/boards/gpsplatinum/board_hw_defs.c b/flight/targets/boards/gpsplatinum/board_hw_defs.c index f72dd0ccb..e4127d022 100644 --- a/flight/targets/boards/gpsplatinum/board_hw_defs.c +++ b/flight/targets/boards/gpsplatinum/board_hw_defs.c @@ -199,6 +199,10 @@ void PIOS_SPI_mag_flash_irq_handler(void) PIOS_SPI_IRQ_Handler(pios_spi_mag_flash_id); } +#ifdef PIOS_INCLUDE_FLASH +#include "pios_flash_jedec_priv.h" +#include "pios_flash.h" +#endif /* PIOS_INCLUDE_FLASH */ #if defined(PIOS_INCLUDE_HMC5X83) #include "pios_hmc5x83.h" diff --git a/flight/targets/boards/gpsplatinum/firmware/Makefile b/flight/targets/boards/gpsplatinum/firmware/Makefile index d62954675..86799241b 100644 --- a/flight/targets/boards/gpsplatinum/firmware/Makefile +++ b/flight/targets/boards/gpsplatinum/firmware/Makefile @@ -56,6 +56,7 @@ SRC += $(OPSYSTEM)/pios_board.c SRC += $(PIOSCOMMON)/pios_hmc5x83.c SRC += $(PIOSCOMMON)/pios_ubx_dcc.c +SRC += $(PIOSCOMMON)/pios_flash_jedec.c ## UAVObjects SRC += $(OPUAVSYNTHDIR)/firmwareiapobj.c diff --git a/flight/targets/boards/gpsplatinum/firmware/inc/pios_config.h b/flight/targets/boards/gpsplatinum/firmware/inc/pios_config.h index a90406d99..204658d64 100644 --- a/flight/targets/boards/gpsplatinum/firmware/inc/pios_config.h +++ b/flight/targets/boards/gpsplatinum/firmware/inc/pios_config.h @@ -112,7 +112,7 @@ /* #define PIOS_OVERO_SPI */ /* #define PIOS_INCLUDE_SDCARD */ /* #define LOG_FILENAME "startup.log" */ -// #define PIOS_INCLUDE_FLASH +#define PIOS_INCLUDE_FLASH // #define PIOS_INCLUDE_FLASH_LOGFS_SETTINGS /* #define FLASH_FREERTOS */ /* #define PIOS_INCLUDE_FLASH_EEPROM */ diff --git a/flight/targets/boards/gpsplatinum/firmware/pios_board.c b/flight/targets/boards/gpsplatinum/firmware/pios_board.c index 24b8bcd6c..7d7e6bf74 100644 --- a/flight/targets/boards/gpsplatinum/firmware/pios_board.c +++ b/flight/targets/boards/gpsplatinum/firmware/pios_board.c @@ -44,10 +44,10 @@ #include "../board_hw_defs.c" #define PIOS_COM_MAIN_RX_BUF_LEN 32 -#define PIOS_COM_MAIN_TX_BUF_LEN 150 +#define PIOS_COM_MAIN_TX_BUF_LEN 128 uint32_t pios_com_main_id; - +uintptr_t flash_id; /** * PIOS_Board_Init() * initializes all the core subsystems on this specific hardware @@ -76,6 +76,9 @@ void PIOS_Board_Init(void) #ifdef PIOS_INCLUDE_HMC5X83 PIOS_SPI_SetClockSpeed(pios_spi_mag_flash_id, SPI_BaudRatePrescaler_16); PIOS_HMC5x83_Init(&pios_mag_cfg, pios_spi_mag_flash_id, 0); + if (PIOS_Flash_Jedec_Init(&flash_id, pios_spi_mag_flash_id, 1)) { + PIOS_DEBUG_Assert(0); + } #endif #endif @@ -119,7 +122,7 @@ void PIOS_Board_Init(void) #if defined(PIOS_INCLUDE_I2C) { if (PIOS_I2C_Init(&pios_i2c_gps_id, &pios_i2c_gps_cfg)) { - PIOS_Assert(0); + flash_id = -1; } } #endif /* PIOS_INCLUDE_I2C */