]>
Commit | Line | Data |
---|---|---|
83d290c5 | 1 | // SPDX-License-Identifier: GPL-2.0+ |
c609719b WD |
2 | /* |
3 | * (C) Copyright 2001 | |
4 | * Erik Theisen, Wave 7 Optics, [email protected]. | |
c609719b WD |
5 | */ |
6 | ||
b106961c | 7 | #ifdef USE_HOSTCC |
f33f3e07 | 8 | #include <linux/kconfig.h> |
b106961c | 9 | #endif |
f33f3e07 | 10 | |
dc17fb6d | 11 | #ifndef __ASSEMBLY__ |
bd2a23ac | 12 | #define __ASSEMBLY__ /* Dirty trick to get only #defines */ |
dc17fb6d | 13 | #endif |
bd2a23ac | 14 | #define __ASM_STUB_PROCESSOR_H__ /* don't include asm/processor. */ |
c609719b | 15 | #include <config.h> |
dc17fb6d | 16 | #undef __ASSEMBLY__ |
f3998fdc | 17 | #include <env_internal.h> |
5368c55d | 18 | #include <linux/stringify.h> |
c609719b | 19 | |
bd2a23ac | 20 | /* Handle HOSTS that have prepended crap on symbol names, not TARGETS. */ |
c609719b WD |
21 | #if defined(__APPLE__) |
22 | /* Leading underscore on symbols */ | |
23 | # define SYM_CHAR "_" | |
24 | #else /* No leading character on symbols */ | |
25 | # define SYM_CHAR | |
26 | #endif | |
27 | ||
a747a7f3 WD |
28 | /* |
29 | * Generate embedded environment table | |
30 | * inside U-Boot image, if needed. | |
31 | */ | |
6bd23720 | 32 | #if defined(ENV_IS_EMBEDDED) |
c609719b | 33 | /* |
7653942b | 34 | * Put the environment in the .text section when we are building |
c609719b | 35 | * U-Boot proper. The host based program "tools/envcrc" does not need |
7653942b | 36 | * a seperate section. |
c609719b | 37 | */ |
7653942b | 38 | #if defined(USE_HOSTCC) /* Native for 'tools/envcrc' */ |
23ac79ff | 39 | # define __UBOOT_ENV_SECTION__(name) /*XXX DO_NOT_DEL_THIS_COMMENT*/ |
c609719b WD |
40 | |
41 | #else /* Environment is embedded in U-Boot's .text section */ | |
42 | /* XXX - This only works with GNU C */ | |
23ac79ff | 43 | # define __UBOOT_ENV_SECTION__(name) __attribute__ ((section(".text."#name))) |
c609719b WD |
44 | #endif |
45 | ||
46 | /* | |
47 | * Macros to generate global absolutes. | |
48 | */ | |
4087bc88 | 49 | #if defined(__bfin__) |
bd2a23ac IG |
50 | # define GEN_SET_VALUE(name, value) \ |
51 | asm(".set " GEN_SYMNAME(name) ", " GEN_VALUE(value)) | |
4087bc88 | 52 | #else |
bd2a23ac IG |
53 | # define GEN_SET_VALUE(name, value) \ |
54 | asm(GEN_SYMNAME(name) " = " GEN_VALUE(value)) | |
55 | #endif | |
56 | #define GEN_SYMNAME(str) SYM_CHAR #str | |
57 | #define GEN_VALUE(str) #str | |
58 | #define GEN_ABS(name, value) \ | |
59 | asm(".globl " GEN_SYMNAME(name)); \ | |
60 | GEN_SET_VALUE(name, value) | |
c609719b | 61 | |
c609719b WD |
62 | /* |
63 | * Check to see if we are building with a | |
64 | * computed CRC. Otherwise define it as ~0. | |
65 | */ | |
66 | #if !defined(ENV_CRC) | |
bd2a23ac | 67 | # define ENV_CRC (~0) |
c609719b WD |
68 | #endif |
69 | ||
ddd8418f | 70 | #define DEFAULT_ENV_INSTANCE_EMBEDDED |
86b9c3e4 | 71 | #include <config.h> |
ddd8418f JH |
72 | #include <env_default.h> |
73 | ||
0e8d1586 | 74 | #ifdef CONFIG_ENV_ADDR_REDUND |
23ac79ff | 75 | env_t redundand_environment __UBOOT_ENV_SECTION__(redundand_environment) = { |
c609719b WD |
76 | 0, /* CRC Sum: invalid */ |
77 | 0, /* Flags: invalid */ | |
78 | { | |
79 | "\0" | |
80 | } | |
81 | }; | |
0e8d1586 | 82 | #endif /* CONFIG_ENV_ADDR_REDUND */ |
c609719b WD |
83 | |
84 | /* | |
85 | * These will end up in the .text section | |
86 | * if the environment strings are embedded | |
87 | * in the image. When this is used for | |
88 | * tools/envcrc, they are placed in the | |
89 | * .data/.sdata section. | |
90 | * | |
91 | */ | |
23ac79ff | 92 | unsigned long env_size __UBOOT_ENV_SECTION__(env_size) = sizeof(env_t); |
c609719b WD |
93 | |
94 | /* | |
95 | * Add in absolutes. | |
96 | */ | |
65cc0e2a | 97 | GEN_ABS(env_offset, (CONFIG_ENV_ADDR - CFG_SYS_FLASH_BASE)); |
a747a7f3 WD |
98 | |
99 | #endif /* ENV_IS_EMBEDDED */ |