comparison BootLoader/Src/base_bootlader.c @ 25:97eafbcb81a9

FIX move bootloader SFirmwareData at fixed address 0x0800A000
author jdg@air
date Wed, 03 Jan 2018 01:40:59 +0100
parents e65d01b6a17e
children ea1003f63e44
comparison
equal deleted inserted replaced
24:4de447ee5d1b 25:97eafbcb81a9
189 * 189 *
190 ****************************************************************************** 190 ******************************************************************************
191 */ 191 */
192 192
193 /* Includes ------------------------------------------------------------------*/ 193 /* Includes ------------------------------------------------------------------*/
194 #include "stdio.h" 194 #include "base_bootloader.h"
195 #include <string.h> // for memcopy 195
196 196 // From Bootloader/Inc:
197 #include "tInfoBootloader.h"
198
199 // ?
200 #include "externLogbookFlash.h"
201 #include "firmwareEraseProgram.h"
202 #include "firmwareJumpToApplication.h"
203
204 // From Common/Inc:
205 #include "FirmwareData.h"
206
207 // From Common/Drivers:
197 #include "stm32f4xx_hal.h" 208 #include "stm32f4xx_hal.h"
198 #include "stm32f4xx_hal_rcc.h" 209 #include "stm32f4xx_hal_rcc.h"
199 #include "stm32f4xx_hal_flash_ex.h" 210 #include "stm32f4xx_hal_flash_ex.h"
200 #include "stm32f4xx_hal_wwdg.h" 211 #include "stm32f4xx_hal_wwdg.h"
201 212
202 #include "ostc.h" 213 // From Discovery/Inc (shall be shared...)
203 #include "base_bootloader.h" 214 #include "data_exchange_main.h"
204 #include "display.h" 215 #include "display.h"
205 #include "gfx_engine.h" 216 #include "gfx_engine.h"
206 #include "externLogbookFlash.h" 217 #include "ostc.h"
207 #include "tComm.h" 218 #include "tComm.h"
208 #include "tStructure.h" 219 #include "tStructure.h"
209 #include "tInfoBootloader.h" 220
210 221 // From AC6 support:
211 #include "firmwareEraseProgram.h" 222 #include <stdio.h>
212 #include "firmwareJumpToApplication.h" 223 #include <string.h> // for memcopy
213
214 #include "data_exchange_main.h"
215 224
216 /** @addtogroup OSTC 4 225 /** @addtogroup OSTC 4
217 * @{ 226 * @{
218 */ 227 */
219 228
223 #define WRITE_READ_ADDR ((uint32_t)0x0000) 232 #define WRITE_READ_ADDR ((uint32_t)0x0000)
224 #define REFRESH_COUNT ((uint32_t)0x0569) /* SDRAM refresh counter (90Mhz SD clock) */ 233 #define REFRESH_COUNT ((uint32_t)0x0569) /* SDRAM refresh counter (90Mhz SD clock) */
225 234
226 /* Private macro -------------------------------------------------------------*/ 235 /* Private macro -------------------------------------------------------------*/
227 /* Private variables ---------------------------------------------------------*/ 236 /* Private variables ---------------------------------------------------------*/
228 uint8_t returnFromCommCleanUpRequest = 0; 237 uint8_t returnFromCommCleanUpRequest = 0;
229 238
230 const SFirmwareData FirmwareData __attribute__((at(0x08000000 + 0x0000A000))) = { 239 const SFirmwareData bootloader_FirmwareData __attribute__(( section(".bootloader_firmware_data") )) =
231 .firmwareVersion16to32bit.ub.first = 1, 240 {
232 .firmwareVersion16to32bit.ub.second = 0, 241 .versionFirst = 1,
233 .firmwareVersion16to32bit.ub.third = 1, 242 .versionSecond = 0,
234 .firmwareVersion16to32bit.ub.betaFlag = 1, 243 .versionThird = 1,
244 .versionBeta = 1,
235 245
236 /* 4 bytes with trailing 0 */ 246 /* 4 bytes with trailing 0 */
237 .signature = "cw", 247 .signature = "cw",
238 248
239 .release_year = 16, 249 .release_year = 16,
240 .release_month = 4, 250 .release_month = 4,
241 .release_day = 8, 251 .release_day = 8,
242 .release_sub = 0, 252 .release_sub = 0,
243 253
244 /* max 48 with trailing 0 */ 254 /* max 48 with trailing 0 */
245 //release_info ="12345678901234567890123456789012345678901"
246 .release_info ="tComm with all", 255 .release_info ="tComm with all",
247 256
248 /* for safety reasons and coming functions*/ 257 /* for safety reasons and coming functions*/
249 .dummy[0] = 0, 258 .magic[0] = FIRMWARE_MAGIC_FIRST,
250 .dummy[1] = 0, 259 .magic[1] = FIRMWARE_MAGIC_SECOND,
251 .dummy[2] = 0xEE, /* the magic byte */ 260 .magic[2] = FIRMWARE_MAGIC_FIRMWARE, /* the magic byte */
252 .dummy[3] = 0xFF 261 .magic[3] = FIRMWARE_MAGIC_END
253 }; 262 };
254 263
255 264
256 const SHardwareData HardwareData __attribute__((at(HARDWAREDATA_ADDRESS))) = { 265 const SHardwareData HardwareData __attribute__((at(HARDWAREDATA_ADDRESS))) = {
257 266
280 .secondary_bluetooth_name_set = 0xFF, 289 .secondary_bluetooth_name_set = 0xFF,
281 .secondary_info = {0xFF,0xFF,0xFF,0xFF} 290 .secondary_info = {0xFF,0xFF,0xFF,0xFF}
282 }; 291 };
283 292
284 293
285 RTC_HandleTypeDef RtcHandle; 294 RTC_HandleTypeDef RtcHandle;
286 TIM_HandleTypeDef TimHandle; /* used in stm32f4xx_it.c too */ 295 TIM_HandleTypeDef TimHandle; /* used in stm32f4xx_it.c too */
287 TIM_HandleTypeDef TimBacklightHandle; /* used in stm32f4xx_it.c too */ 296 TIM_HandleTypeDef TimBacklightHandle; /* used in stm32f4xx_it.c too */
288 297
289 uint32_t time_before; 298 uint32_t time_before;
290 uint32_t time_between; 299 uint32_t time_between;