Blame view
env/embedded.c
2.45 KB
83d290c56 SPDX: Convert all... |
1 |
// SPDX-License-Identifier: GPL-2.0+ |
c609719b8 Initial revision |
2 3 4 |
/* * (C) Copyright 2001 * Erik Theisen, Wave 7 Optics, etheisen@mindspring.com. |
c609719b8 Initial revision |
5 |
*/ |
f33f3e07f tools/env: Correc... |
6 |
#include <linux/kconfig.h> |
dc17fb6dc Cleanup build pro... |
7 |
#ifndef __ASSEMBLY__ |
bd2a23ac6 env: clean env_em... |
8 |
#define __ASSEMBLY__ /* Dirty trick to get only #defines */ |
dc17fb6dc Cleanup build pro... |
9 |
#endif |
bd2a23ac6 env: clean env_em... |
10 |
#define __ASM_STUB_PROCESSOR_H__ /* don't include asm/processor. */ |
c609719b8 Initial revision |
11 |
#include <config.h> |
dc17fb6dc Cleanup build pro... |
12 |
#undef __ASSEMBLY__ |
f3998fdc4 env: Rename envir... |
13 |
#include <env_internal.h> |
5368c55d4 COMMON: Use __str... |
14 |
#include <linux/stringify.h> |
c609719b8 Initial revision |
15 |
|
bd2a23ac6 env: clean env_em... |
16 |
/* Handle HOSTS that have prepended crap on symbol names, not TARGETS. */ |
c609719b8 Initial revision |
17 18 19 20 21 22 23 24 |
#if defined(__APPLE__) /* Leading underscore on symbols */ # define SYM_CHAR "_" #else /* No leading character on symbols */ # define SYM_CHAR #endif /* |
a747a7f31 Revert "env: only... |
25 26 27 |
* Generate embedded environment table * inside U-Boot image, if needed. */ |
c3eb3fe49 env: allow people... |
28 |
#if defined(ENV_IS_EMBEDDED) || defined(CONFIG_BUILD_ENVCRC) |
a747a7f31 Revert "env: only... |
29 |
/* |
7653942b1 common/env_embedd... |
30 |
* Put the environment in the .text section when we are building |
c609719b8 Initial revision |
31 |
* U-Boot proper. The host based program "tools/envcrc" does not need |
7653942b1 common/env_embedd... |
32 |
* a seperate section. |
c609719b8 Initial revision |
33 |
*/ |
7653942b1 common/env_embedd... |
34 |
#if defined(USE_HOSTCC) /* Native for 'tools/envcrc' */ |
23ac79ff8 common: env_embed... |
35 |
# define __UBOOT_ENV_SECTION__(name) /*XXX DO_NOT_DEL_THIS_COMMENT*/ |
c609719b8 Initial revision |
36 37 38 |
#else /* Environment is embedded in U-Boot's .text section */ /* XXX - This only works with GNU C */ |
23ac79ff8 common: env_embed... |
39 |
# define __UBOOT_ENV_SECTION__(name) __attribute__ ((section(".text."#name))) |
c609719b8 Initial revision |
40 41 42 43 44 |
#endif /* * Macros to generate global absolutes. */ |
4087bc88c fix building on B... |
45 |
#if defined(__bfin__) |
bd2a23ac6 env: clean env_em... |
46 47 |
# define GEN_SET_VALUE(name, value) \ asm(".set " GEN_SYMNAME(name) ", " GEN_VALUE(value)) |
4087bc88c fix building on B... |
48 |
#else |
bd2a23ac6 env: clean env_em... |
49 50 51 52 53 54 55 56 |
# define GEN_SET_VALUE(name, value) \ asm(GEN_SYMNAME(name) " = " GEN_VALUE(value)) #endif #define GEN_SYMNAME(str) SYM_CHAR #str #define GEN_VALUE(str) #str #define GEN_ABS(name, value) \ asm(".globl " GEN_SYMNAME(name)); \ GEN_SET_VALUE(name, value) |
c609719b8 Initial revision |
57 58 |
/* |
c609719b8 Initial revision |
59 60 61 62 |
* Check to see if we are building with a * computed CRC. Otherwise define it as ~0. */ #if !defined(ENV_CRC) |
bd2a23ac6 env: clean env_em... |
63 |
# define ENV_CRC (~0) |
c609719b8 Initial revision |
64 |
#endif |
ddd8418f7 env: cosmetic: Co... |
65 66 |
#define DEFAULT_ENV_INSTANCE_EMBEDDED #include <env_default.h> |
0e8d15866 rename CFG_ENV ma... |
67 |
#ifdef CONFIG_ENV_ADDR_REDUND |
23ac79ff8 common: env_embed... |
68 |
env_t redundand_environment __UBOOT_ENV_SECTION__(redundand_environment) = { |
c609719b8 Initial revision |
69 70 71 72 73 74 |
0, /* CRC Sum: invalid */ 0, /* Flags: invalid */ { "\0" } }; |
0e8d15866 rename CFG_ENV ma... |
75 |
#endif /* CONFIG_ENV_ADDR_REDUND */ |
c609719b8 Initial revision |
76 77 78 79 80 81 82 83 84 |
/* * These will end up in the .text section * if the environment strings are embedded * in the image. When this is used for * tools/envcrc, they are placed in the * .data/.sdata section. * */ |
23ac79ff8 common: env_embed... |
85 |
unsigned long env_size __UBOOT_ENV_SECTION__(env_size) = sizeof(env_t); |
c609719b8 Initial revision |
86 87 88 89 |
/* * Add in absolutes. */ |
a09fea1d2 env: Finish migra... |
90 |
GEN_ABS(env_offset, (CONFIG_ENV_ADDR - CONFIG_SYS_FLASH_BASE)); |
a747a7f31 Revert "env: only... |
91 92 |
#endif /* ENV_IS_EMBEDDED */ |