mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-17 13:25:30 +03:00
Fix missing CUSTOM_DEFAULTS for H730/H750 targets. (#12261)
This commit is contained in:
parent
7207892ab1
commit
9850749afa
6 changed files with 82 additions and 4 deletions
|
@ -98,6 +98,21 @@ SECTIONS
|
||||||
PROVIDE_HIDDEN (__pg_resetdata_end = .);
|
PROVIDE_HIDDEN (__pg_resetdata_end = .);
|
||||||
} >MAIN
|
} >MAIN
|
||||||
|
|
||||||
|
/* Storage for the address for the configuration section so we can grab it out of the hex file */
|
||||||
|
.custom_defaults :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
KEEP (*(.custom_defaults_start_address))
|
||||||
|
. = ALIGN(4);
|
||||||
|
KEEP (*(.custom_defaults_end_address))
|
||||||
|
. = ALIGN(4);
|
||||||
|
__custom_defaults_internal_start = .;
|
||||||
|
*(.custom_defaults);
|
||||||
|
} >CUSTOM_DEFAULTS
|
||||||
|
|
||||||
|
PROVIDE_HIDDEN (__custom_defaults_start = __custom_defaults_internal_start);
|
||||||
|
PROVIDE_HIDDEN (__custom_defaults_end = ORIGIN(CUSTOM_DEFAULTS) + LENGTH(CUSTOM_DEFAULTS));
|
||||||
|
|
||||||
/* used by the startup to initialize data */
|
/* used by the startup to initialize data */
|
||||||
_sidata = LOADADDR(.data);
|
_sidata = LOADADDR(.data);
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,21 @@ SECTIONS
|
||||||
PROVIDE_HIDDEN (__pg_resetdata_end = .);
|
PROVIDE_HIDDEN (__pg_resetdata_end = .);
|
||||||
} >MAIN
|
} >MAIN
|
||||||
|
|
||||||
|
/* Storage for the address for the configuration section so we can grab it out of the hex file */
|
||||||
|
.custom_defaults :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
KEEP (*(.custom_defaults_start_address))
|
||||||
|
. = ALIGN(4);
|
||||||
|
KEEP (*(.custom_defaults_end_address))
|
||||||
|
. = ALIGN(4);
|
||||||
|
__custom_defaults_internal_start = .;
|
||||||
|
*(.custom_defaults);
|
||||||
|
} >CUSTOM_DEFAULTS
|
||||||
|
|
||||||
|
PROVIDE_HIDDEN (__custom_defaults_start = __custom_defaults_internal_start);
|
||||||
|
PROVIDE_HIDDEN (__custom_defaults_end = ORIGIN(CUSTOM_DEFAULTS) + LENGTH(CUSTOM_DEFAULTS));
|
||||||
|
|
||||||
/* used by the startup to initialize data */
|
/* used by the startup to initialize data */
|
||||||
_sidata = LOADADDR(.data);
|
_sidata = LOADADDR(.data);
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,24 @@ The initial CODE_RAM is sized at 1MB.
|
||||||
/* see .exst section below */
|
/* see .exst section below */
|
||||||
_exst_hash_size = 64;
|
_exst_hash_size = 64;
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
A section for custom defaults needs to exist for unified targets, however it is a hideous waste of precious RAM.
|
||||||
|
Using RAM will suffice until an alternative location for it can be made workable.
|
||||||
|
|
||||||
|
It would be much better to store the custom defaults on some spare flash pages on the external flash and have some
|
||||||
|
code to read them from external flash instead of a copy of them stored in precious RAM.
|
||||||
|
There are usually spare flash pages after the config page on the external flash, however current EXST bootloaders are
|
||||||
|
not 'custom defaults' aware. they only know about firmware partitions and config partitions. Using the spare sectors
|
||||||
|
in the config partition for custom defaults would work, but if users use the bootloader menus to erase their config
|
||||||
|
then the custom defaults would also be erased...
|
||||||
|
Also, it would need a change the packaging a distribution method of BF as there would be 2 non-contiguous files to
|
||||||
|
flash if they were separated, i.e. load firmware at flash address 'x' and load custom defaults at flash address 'y'.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
_custom_defaults_size = 8K;
|
||||||
|
|
||||||
/* Specify the memory areas */
|
/* Specify the memory areas */
|
||||||
MEMORY
|
MEMORY
|
||||||
{
|
{
|
||||||
|
@ -62,8 +80,9 @@ MEMORY
|
||||||
|
|
||||||
OCTOSPI2 (rx) : ORIGIN = 0x70000000, LENGTH = 256M
|
OCTOSPI2 (rx) : ORIGIN = 0x70000000, LENGTH = 256M
|
||||||
OCTOSPI1 (rx) : ORIGIN = 0x90000000, LENGTH = 256M
|
OCTOSPI1 (rx) : ORIGIN = 0x90000000, LENGTH = 256M
|
||||||
OCTOSPI1_CODE (rx): ORIGIN = ORIGIN(OCTOSPI1) + 1M, LENGTH = 1M - _exst_hash_size /* hard coded start address, as required by SPRACINGH7 boot loader, don't change! */
|
OCTOSPI1_CODE (rx): ORIGIN = ORIGIN(OCTOSPI1) + 1M, LENGTH = 1M - _custom_defaults_size - _exst_hash_size /* hard coded start address, as required by SPRACINGH7 boot loader, don't change! */
|
||||||
EXST_HASH (rx) : ORIGIN = ORIGIN(OCTOSPI1_CODE) + LENGTH(OCTOSPI1_CODE), LENGTH = _exst_hash_size
|
CUSTOM_DEFAULTS (r) : ORIGIN = ORIGIN(OCTOSPI1_CODE) + LENGTH(OCTOSPI1_CODE), LENGTH = _custom_defaults_size
|
||||||
|
EXST_HASH (rx) : ORIGIN = ORIGIN(OCTOSPI1_CODE) + LENGTH(CUSTOM_DEFAULTS) + LENGTH(OCTOSPI1_CODE), LENGTH = _exst_hash_size
|
||||||
}
|
}
|
||||||
|
|
||||||
REGION_ALIAS("STACKRAM", DTCM_RAM)
|
REGION_ALIAS("STACKRAM", DTCM_RAM)
|
||||||
|
|
|
@ -54,14 +54,34 @@ possible.
|
||||||
/* see .exst section below */
|
/* see .exst section below */
|
||||||
_exst_hash_size = 64;
|
_exst_hash_size = 64;
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
A section for custom defaults needs to exist for unified targets, however it is a hideous waste of precious RAM.
|
||||||
|
Using RAM will suffice until an alternative location for it can be made workable.
|
||||||
|
|
||||||
|
It would be much better to store the custom defaults on some spare flash pages on the external flash and have some
|
||||||
|
code to read them from external flash instead of a copy of them stored in precious RAM.
|
||||||
|
There are usually spare flash pages after the config page on the external flash, however current EXST bootloaders are
|
||||||
|
not 'custom defaults' aware. they only know about firmware partitions and config partitions. Using the spare sectors
|
||||||
|
in the config partition for custom defaults would work, but if users use the bootloader menus to erase their config
|
||||||
|
then the custom defaults would also be erased...
|
||||||
|
Also, it would need a change the packaging a distribution method of BF as there would be 2 non-contiguous files to
|
||||||
|
flash if they were separated, i.e. load firmware at flash address 'x' and load custom defaults at flash address 'y'.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
_custom_defaults_size = 8K;
|
||||||
|
|
||||||
/* Specify the memory areas */
|
/* Specify the memory areas */
|
||||||
MEMORY
|
MEMORY
|
||||||
{
|
{
|
||||||
ITCM_RAM (rwx) : ORIGIN = 0x00000000, LENGTH = 64K
|
ITCM_RAM (rwx) : ORIGIN = 0x00000000, LENGTH = 64K
|
||||||
DTCM_RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 128K
|
DTCM_RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 128K
|
||||||
RAM (rwx) : ORIGIN = 0x24000000, LENGTH = 64K
|
RAM (rwx) : ORIGIN = 0x24000000, LENGTH = 64K
|
||||||
CODE_RAM (rx) : ORIGIN = 0x24010000, LENGTH = 448K - _exst_hash_size /* hard coded start address, as required by SPRACINGH7 boot loader, don't change! */
|
CODE_RAM (rx) : ORIGIN = 0x24010000, LENGTH = 448K - _custom_defaults_size - _exst_hash_size /* hard coded start address, as required by SPRACINGH7 boot loader, don't change! */
|
||||||
EXST_HASH (rx) : ORIGIN = 0x24010000 + LENGTH(CODE_RAM), LENGTH = _exst_hash_size
|
CUSTOM_DEFAULTS (r) : ORIGIN = ORIGIN(CODE_RAM) + LENGTH(CODE_RAM), LENGTH = _custom_defaults_size
|
||||||
|
|
||||||
|
EXST_HASH (rx) : ORIGIN = 0x24010000 + LENGTH(CODE_RAM) + LENGTH(CUSTOM_DEFAULTS), LENGTH = _exst_hash_size
|
||||||
|
|
||||||
D2_RAM (rwx) : ORIGIN = 0x30000000, LENGTH = 256K /* SRAM1 + SRAM2 */
|
D2_RAM (rwx) : ORIGIN = 0x30000000, LENGTH = 256K /* SRAM1 + SRAM2 */
|
||||||
|
|
||||||
|
|
|
@ -107,3 +107,7 @@
|
||||||
#if !defined(CONFIG_IN_RAM) && !defined(CONFIG_IN_SDCARD) && !defined(CONFIG_IN_EXTERNAL_FLASH)
|
#if !defined(CONFIG_IN_RAM) && !defined(CONFIG_IN_SDCARD) && !defined(CONFIG_IN_EXTERNAL_FLASH)
|
||||||
#define CONFIG_IN_RAM
|
#define CONFIG_IN_RAM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_EXST
|
||||||
|
#define USE_CUSTOM_DEFAULTS
|
||||||
|
#endif
|
||||||
|
|
|
@ -114,3 +114,8 @@
|
||||||
#if !defined(CONFIG_IN_RAM) && !defined(CONFIG_IN_SDCARD) && !defined(CONFIG_IN_EXTERNAL_FLASH)
|
#if !defined(CONFIG_IN_RAM) && !defined(CONFIG_IN_SDCARD) && !defined(CONFIG_IN_EXTERNAL_FLASH)
|
||||||
#define CONFIG_IN_RAM
|
#define CONFIG_IN_RAM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_EXST
|
||||||
|
#define USE_CUSTOM_DEFAULTS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue