@@ -13,10 +13,10 @@
|
||||
"UndervoltageString": "Nízke napätie",
|
||||
"InputVoltageString": "Vstupné U: ",
|
||||
"SleepingSimpleString": "Chrr",
|
||||
"SleepingAdvancedString": "Pokojový režim..",
|
||||
"SleepingAdvancedString": "Pokojový režim.",
|
||||
"SleepingTipAdvancedString": "Hrot:",
|
||||
"OffString": "Vyp",
|
||||
"DeviceFailedValidationWarning": "Your device is most likely a counterfeit!"
|
||||
"DeviceFailedValidationWarning": "Vaše zariadenie je pravdepodobne falzifikát!"
|
||||
},
|
||||
"messagesWarn": {
|
||||
"ResetOKMessage": "Reset OK",
|
||||
@@ -311,7 +311,7 @@
|
||||
"LanguageSwitch": {
|
||||
"text2": [
|
||||
"Jazyk:",
|
||||
" SK Slovenčina"
|
||||
" SK Slovenčina"
|
||||
],
|
||||
"desc": ""
|
||||
},
|
||||
@@ -331,10 +331,10 @@
|
||||
},
|
||||
"LOGOTime": {
|
||||
"text2": [
|
||||
"Boot logo",
|
||||
"duration"
|
||||
"Trvanie",
|
||||
"boot loga"
|
||||
],
|
||||
"desc": "Set boot logo duration (s=seconds)"
|
||||
"desc": "Doba trvania boot loga (s=sekundy)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -152,15 +152,15 @@ S_SRCS := $(shell find $(MINIWARE_STARTUP_DIR) -type f -name '*.S')
|
||||
LDSCRIPT=$(MINIWARE_LD_FILE)
|
||||
DEV_GLOBAL_DEFS= -D STM32F103T8Ux -D STM32F1 -D STM32 -D USE_HAL_DRIVER -D STM32F103xB -D USE_RTOS_SYSTICK -D GCC_ARMCM3 \
|
||||
-D ARM_MATH_CM3 \
|
||||
-D STM32F10X_MD
|
||||
DEV_LDFLAGS=
|
||||
-D STM32F10X_MD
|
||||
DEV_LDFLAGS= -Wl,--wrap=printf -Wl,--no-wchar-size-warning
|
||||
DEV_AFLAGS=
|
||||
DEV_CFLAGS= -D VECT_TAB_OFFSET=$(bootldr_size)U
|
||||
DEV_CXXFLAGS=
|
||||
CPUFLAGS= -mcpu=cortex-m3 \
|
||||
-mthumb \
|
||||
-mfloat-abi=soft
|
||||
flash_size=64k
|
||||
flash_size=62k
|
||||
bootldr_size=0x4000
|
||||
DEVICE_DFU_ADDRESS=0x08004000
|
||||
DEVICE_DFU_VID_PID=0x1209:0xDB42
|
||||
@@ -186,7 +186,7 @@ DEV_CXXFLAGS=
|
||||
CPUFLAGS= -mcpu=cortex-m3 \
|
||||
-mthumb \
|
||||
-mfloat-abi=soft
|
||||
flash_size=128k
|
||||
flash_size=126k
|
||||
bootldr_size=32k
|
||||
DEVICE_DFU_ADDRESS=0x08008000
|
||||
DEVICE_DFU_VID_PID=0x1209:0xDB42
|
||||
@@ -313,7 +313,7 @@ $(shell find $(DEVICE_BSP_DIR) -type d \( $(EXCLUDED_DIRS) \) -prune -false -o
|
||||
$(shell find $(SOURCE_MIDDLEWARES_DIR) -type f -name '*.cpp')
|
||||
|
||||
# code optimisation ------------------------------------------------------------
|
||||
OPTIM=-Os -flto -finline-small-functions -findirect-inlining -fdiagnostics-color -ffunction-sections -fdata-sections -fshort-enums -fsingle-precision-constant -fno-common
|
||||
OPTIM=-Os -fshort-wchar -flto -finline-small-functions -findirect-inlining -fdiagnostics-color -ffunction-sections -fdata-sections -fshort-enums -fsingle-precision-constant -fno-common
|
||||
|
||||
# global defines ---------------------------------------------------------------
|
||||
GLOBAL_DEFINES += $(DEV_GLOBAL_DEFS) -D USE_RTOS_SYSTICK -D MODEL_$(model) -D VECT_TAB_OFFSET=$(bootldr_size)U -fshort-wchar
|
||||
@@ -343,6 +343,7 @@ endif
|
||||
CC=$(COMPILER_PREFIX)-gcc
|
||||
CPP=$(COMPILER_PREFIX)-g++
|
||||
OBJCOPY=$(COMPILER_PREFIX)-objcopy
|
||||
SIZE=$(COMPILER_PREFIX)-size
|
||||
OBJDUMP=$(COMPILER_PREFIX)-objdump
|
||||
# use gcc in assembler mode so we can use defines etc in assembly
|
||||
AS=$(COMPILER_PREFIX)-gcc -x assembler-with-cpp
|
||||
@@ -405,7 +406,7 @@ CXXFLAGS=$(DEV_CXXFLAGS) \
|
||||
-D${COMPILER} \
|
||||
-MMD \
|
||||
$(CHECKOPTIONS) \
|
||||
-std=c++14 \
|
||||
-std=c++17 \
|
||||
$(OPTIM) \
|
||||
-fno-rtti \
|
||||
-fno-exceptions \
|
||||
@@ -469,6 +470,7 @@ firmware-%: $(HEXFILE_DIR)/$(model)_%.hex $(HEXFILE_DIR)/$(model)_%.bin $(HEXFIL
|
||||
|
||||
%.bin : %.elf Makefile
|
||||
$(OBJCOPY) $< -O binary $@
|
||||
$(SIZE) $<
|
||||
|
||||
%.dfu : %.bin Makefile
|
||||
python3 dfuse-pack.py -b $(DEVICE_DFU_ADDRESS)@0:$< -D $(DEVICE_DFU_VID_PID) $@
|
||||
|
||||
Reference in New Issue
Block a user