Fixing up TS80P Build (#1429)
* Silence wchart warning + go back to simple size limiter Going from smart linker file to basic #defines to make things just easier to debug * 2 deg c increments for NTC table * Update cmsis_gcc.h * Drop special linker * Update portmacro.h * Update Makefile
This commit is contained in:
@@ -10,14 +10,15 @@
|
||||
#include "stm32f1xx_hal.h"
|
||||
#include "string.h"
|
||||
|
||||
static uint16_t settings_page[512] __attribute__((section(".settings_page")));
|
||||
#define SETTINGS_START_PAGE (0x08000000 + (127 * 1024))
|
||||
|
||||
|
||||
uint8_t flash_save_buffer(const uint8_t *buffer, const uint16_t length) {
|
||||
FLASH_EraseInitTypeDef pEraseInit;
|
||||
pEraseInit.TypeErase = FLASH_TYPEERASE_PAGES;
|
||||
pEraseInit.Banks = FLASH_BANK_1;
|
||||
pEraseInit.NbPages = 1;
|
||||
pEraseInit.PageAddress = (uint32_t)settings_page;
|
||||
pEraseInit.PageAddress = (uint32_t)SETTINGS_START_PAGE;
|
||||
uint32_t failingAddress = 0;
|
||||
resetWatchdog();
|
||||
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_WRPERR | FLASH_FLAG_PGERR | FLASH_FLAG_BSY);
|
||||
@@ -32,13 +33,10 @@ uint8_t flash_save_buffer(const uint8_t *buffer, const uint16_t length) {
|
||||
HAL_FLASH_Unlock();
|
||||
for (uint16_t i = 0; i < (length / 2); i++) {
|
||||
resetWatchdog();
|
||||
HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, (uint32_t)&settings_page[i], data[i]);
|
||||
HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, SETTINGS_START_PAGE+ (i*sizeof(uint32_t)), data[i]);
|
||||
}
|
||||
HAL_FLASH_Lock();
|
||||
return 1;
|
||||
}
|
||||
|
||||
void flash_read_buffer(uint8_t *buffer, const uint16_t length) {
|
||||
memset(buffer, 0, length);
|
||||
memcpy(buffer, settings_page, length);
|
||||
}
|
||||
void flash_read_buffer(uint8_t *buffer, const uint16_t length) { memcpy(buffer, (uint8_t*)SETTINGS_START_PAGE, length); }
|
||||
|
||||
@@ -116,17 +116,6 @@ SECTIONS
|
||||
_edata = .; /* define a global symbol at data end */
|
||||
} >RAM AT> ROM
|
||||
|
||||
.logo_page (NOLOAD) :
|
||||
{
|
||||
. = ABSOLUTE(__FLASH_END_ADDR__ - 2048);
|
||||
KEEP (*(.logo_page*))
|
||||
} > ROM
|
||||
|
||||
.settings_page (NOLOAD) :
|
||||
{
|
||||
. = ABSOLUTE(__FLASH_END_ADDR__ - 1024);
|
||||
KEEP (*(.settings_page*))
|
||||
} > ROM
|
||||
|
||||
.bss :
|
||||
{
|
||||
|
||||
@@ -29,66 +29,29 @@ void resetWatchdog() { HAL_IWDG_Refresh(&hiwdg); }
|
||||
static const uint16_t NTCHandleLookup[] = {
|
||||
// ADC Reading , Temp in C
|
||||
29189, 0, //
|
||||
29014, 1, //
|
||||
28832, 2, //
|
||||
28644, 3, //
|
||||
28450, 4, //
|
||||
28249, 5, //
|
||||
28042, 6, //
|
||||
27828, 7, //
|
||||
27607, 8, //
|
||||
27380, 9, //
|
||||
27146, 10, //
|
||||
26906, 11, //
|
||||
26660, 12, //
|
||||
26407, 13, //
|
||||
26147, 14, //
|
||||
25882, 15, //
|
||||
25610, 16, //
|
||||
25332, 17, //
|
||||
25049, 18, //
|
||||
24759, 19, //
|
||||
24465, 20, //
|
||||
24164, 21, //
|
||||
23859, 22, //
|
||||
23549, 23, //
|
||||
23234, 24, //
|
||||
22915, 25, //
|
||||
22591, 26, //
|
||||
22264, 27, //
|
||||
21933, 28, //
|
||||
21599, 29, //
|
||||
21261, 30, //
|
||||
20921, 31, //
|
||||
20579, 32, //
|
||||
20234, 33, //
|
||||
19888, 34, //
|
||||
19541, 35, //
|
||||
19192, 36, //
|
||||
18843, 37, //
|
||||
18493, 38, //
|
||||
18143, 39, //
|
||||
17793, 40, //
|
||||
17444, 41, //
|
||||
17096, 42, //
|
||||
16750, 43, //
|
||||
16404, 44, //
|
||||
16061, 45, //
|
||||
// 15719, 46, //
|
||||
// 15380, 47, //
|
||||
// 15044, 48, //
|
||||
// 14710, 49, //
|
||||
// 14380, 50, //
|
||||
// 14053, 51, //
|
||||
// 13729, 52, //
|
||||
// 13410, 53, //
|
||||
// 13094, 54, //
|
||||
// 12782, 55, //
|
||||
// 12475, 56, //
|
||||
// 12172, 57, //
|
||||
// 11874, 58, //
|
||||
// 11580, 59, //
|
||||
// 11292, 60, //
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_xPSR(void) {
|
||||
\return PSP Register value
|
||||
*/
|
||||
__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_PSP(void) {
|
||||
register uint32_t result;
|
||||
uint32_t result;
|
||||
|
||||
__ASM volatile("MRS %0, psp\n" : "=r"(result));
|
||||
return (result);
|
||||
@@ -143,7 +143,7 @@ __attribute__((always_inline)) __STATIC_INLINE void __set_PSP(uint32_t topOfProc
|
||||
\return MSP Register value
|
||||
*/
|
||||
__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_MSP(void) {
|
||||
register uint32_t result;
|
||||
uint32_t result;
|
||||
|
||||
__ASM volatile("MRS %0, msp\n" : "=r"(result));
|
||||
return (result);
|
||||
|
||||
@@ -10,14 +10,14 @@
|
||||
#include "stm32f1xx_hal.h"
|
||||
#include "string.h"
|
||||
|
||||
static uint16_t settings_page[512] __attribute__((section(".settings_page")));
|
||||
#define SETTINGS_START_PAGE (0x08000000 + (63 * 1024))
|
||||
|
||||
uint8_t flash_save_buffer(const uint8_t *buffer, const uint16_t length) {
|
||||
FLASH_EraseInitTypeDef pEraseInit;
|
||||
pEraseInit.TypeErase = FLASH_TYPEERASE_PAGES;
|
||||
pEraseInit.Banks = FLASH_BANK_1;
|
||||
pEraseInit.NbPages = 1;
|
||||
pEraseInit.PageAddress = (uint32_t)settings_page;
|
||||
pEraseInit.PageAddress = (uint32_t)SETTINGS_START_PAGE;
|
||||
uint32_t failingAddress = 0;
|
||||
resetWatchdog();
|
||||
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_WRPERR | FLASH_FLAG_PGERR | FLASH_FLAG_BSY);
|
||||
@@ -32,10 +32,10 @@ uint8_t flash_save_buffer(const uint8_t *buffer, const uint16_t length) {
|
||||
HAL_FLASH_Unlock();
|
||||
for (uint16_t i = 0; i < (length / 2); i++) {
|
||||
resetWatchdog();
|
||||
HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, (uint32_t)&settings_page[i], data[i]);
|
||||
HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, SETTINGS_START_PAGE+ (i*sizeof(uint32_t)), data[i]);
|
||||
}
|
||||
HAL_FLASH_Lock();
|
||||
return 1;
|
||||
}
|
||||
|
||||
void flash_read_buffer(uint8_t *buffer, const uint16_t length) { memcpy(buffer, settings_page, length); }
|
||||
void flash_read_buffer(uint8_t *buffer, const uint16_t length) { memcpy(buffer, (uint8_t*)SETTINGS_START_PAGE, length); }
|
||||
|
||||
@@ -116,17 +116,6 @@ SECTIONS
|
||||
_edata = .; /* define a global symbol at data end */
|
||||
} >RAM AT> ROM
|
||||
|
||||
.logo_page (NOLOAD) :
|
||||
{
|
||||
. = ABSOLUTE(__FLASH_END_ADDR__ - 2048);
|
||||
KEEP (*(.logo_page*))
|
||||
} > ROM
|
||||
|
||||
.settings_page (NOLOAD) :
|
||||
{
|
||||
. = ABSOLUTE(__FLASH_END_ADDR__ - 1024);
|
||||
KEEP (*(.settings_page*))
|
||||
} > ROM
|
||||
|
||||
.bss :
|
||||
{
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
#include "gd32vf103_libopt.h"
|
||||
#include "string.h"
|
||||
#define FMC_PAGE_SIZE ((uint16_t)0x400U)
|
||||
// static uint16_t settings_page[FMC_PAGE_SIZE] __attribute__ ((section (".settings_page")));
|
||||
// Linker script doesnt want to play, so for now its hard coded
|
||||
#define SETTINGS_START_PAGE (0x08000000 + (127 * 1024))
|
||||
uint8_t flash_save_buffer(const uint8_t *buffer, const uint16_t length) {
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ extern "C" {
|
||||
* These settings should not be altered.
|
||||
*-----------------------------------------------------------
|
||||
*/
|
||||
#include "FreeRTOSConfig.h"
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user