mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-11-28 22:21:49 +01:00
common: env_embedded: allow fine placement of environment object
Commit 7653942b10e9e ("common/env_embedded.c: drop support for
CONFIG_SYS_USE_PPCENV") dropped the .ppcenv section which was
used in linking scripts to allow fine placement of embedded
environment sections.
This implies that GCC randomly places objects from env/embedded.o
and environment is not guaranteed to be located at the correct address:
04003df8 g F .text 00000038 mii_init
04004000 g O .text 00000004 env_size
04004004 g O .text 00002000 environment
04006004 g F .text 00000040 .hidden __lshrdi3
This patch restores this capability by allocating each object marked
with __UBOOT_ENV_SECTION__ into a different section. Hence
'environment' will be alone in .text.environment, allowing a
fine placement in u-boot.lds with:
. = DEFINED(env_offset) ? env_offset : .;
env/embedded.o (.text.environment)
Fixes: 7653942b10e9e ("common/env_embedded.c: drop support for CONFIG_SYS_USE_PPCENV")
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
This commit is contained in:
parent
b3ede33170
commit
23ac79ff80
8
env/embedded.c
vendored
8
env/embedded.c
vendored
@ -35,11 +35,11 @@
|
|||||||
* a seperate section.
|
* a seperate section.
|
||||||
*/
|
*/
|
||||||
#if defined(USE_HOSTCC) /* Native for 'tools/envcrc' */
|
#if defined(USE_HOSTCC) /* Native for 'tools/envcrc' */
|
||||||
# define __UBOOT_ENV_SECTION__ /*XXX DO_NOT_DEL_THIS_COMMENT*/
|
# define __UBOOT_ENV_SECTION__(name) /*XXX DO_NOT_DEL_THIS_COMMENT*/
|
||||||
|
|
||||||
#else /* Environment is embedded in U-Boot's .text section */
|
#else /* Environment is embedded in U-Boot's .text section */
|
||||||
/* XXX - This only works with GNU C */
|
/* XXX - This only works with GNU C */
|
||||||
# define __UBOOT_ENV_SECTION__ __attribute__ ((section(".text")))
|
# define __UBOOT_ENV_SECTION__(name) __attribute__ ((section(".text."#name)))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -70,7 +70,7 @@
|
|||||||
#include <env_default.h>
|
#include <env_default.h>
|
||||||
|
|
||||||
#ifdef CONFIG_ENV_ADDR_REDUND
|
#ifdef CONFIG_ENV_ADDR_REDUND
|
||||||
env_t redundand_environment __UBOOT_ENV_SECTION__ = {
|
env_t redundand_environment __UBOOT_ENV_SECTION__(redundand_environment) = {
|
||||||
0, /* CRC Sum: invalid */
|
0, /* CRC Sum: invalid */
|
||||||
0, /* Flags: invalid */
|
0, /* Flags: invalid */
|
||||||
{
|
{
|
||||||
@ -87,7 +87,7 @@ env_t redundand_environment __UBOOT_ENV_SECTION__ = {
|
|||||||
* .data/.sdata section.
|
* .data/.sdata section.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
unsigned long env_size __UBOOT_ENV_SECTION__ = sizeof(env_t);
|
unsigned long env_size __UBOOT_ENV_SECTION__(env_size) = sizeof(env_t);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add in absolutes.
|
* Add in absolutes.
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
#include <env_callback.h>
|
#include <env_callback.h>
|
||||||
|
|
||||||
#ifdef DEFAULT_ENV_INSTANCE_EMBEDDED
|
#ifdef DEFAULT_ENV_INSTANCE_EMBEDDED
|
||||||
env_t environment __UBOOT_ENV_SECTION__ = {
|
env_t environment __UBOOT_ENV_SECTION__(environment) = {
|
||||||
ENV_CRC, /* CRC Sum */
|
ENV_CRC, /* CRC Sum */
|
||||||
#ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT
|
#ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT
|
||||||
1, /* Flags: valid */
|
1, /* Flags: valid */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user