Blame view
env/embedded.c
2.45 KB
83d290c56
|
1 |
// SPDX-License-Identifier: GPL-2.0+ |
c609719b8
|
2 3 4 |
/* * (C) Copyright 2001 * Erik Theisen, Wave 7 Optics, etheisen@mindspring.com. |
c609719b8
|
5 |
*/ |
f33f3e07f
|
6 |
#include <linux/kconfig.h> |
dc17fb6dc
|
7 |
#ifndef __ASSEMBLY__ |
bd2a23ac6
|
8 |
#define __ASSEMBLY__ /* Dirty trick to get only #defines */ |
dc17fb6dc
|
9 |
#endif |
bd2a23ac6
|
10 |
#define __ASM_STUB_PROCESSOR_H__ /* don't include asm/processor. */ |
c609719b8
|
11 |
#include <config.h> |
dc17fb6dc
|
12 |
#undef __ASSEMBLY__ |
f3998fdc4
|
13 |
#include <env_internal.h> |
5368c55d4
|
14 |
#include <linux/stringify.h> |
c609719b8
|
15 |
|
bd2a23ac6
|
16 |
/* Handle HOSTS that have prepended crap on symbol names, not TARGETS. */ |
c609719b8
|
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
|
25 26 27 |
* Generate embedded environment table * inside U-Boot image, if needed. */ |
c3eb3fe49
|
28 |
#if defined(ENV_IS_EMBEDDED) || defined(CONFIG_BUILD_ENVCRC) |
a747a7f31
|
29 |
/* |
7653942b1
|
30 |
* Put the environment in the .text section when we are building |
c609719b8
|
31 |
* U-Boot proper. The host based program "tools/envcrc" does not need |
7653942b1
|
32 |
* a seperate section. |
c609719b8
|
33 |
*/ |
7653942b1
|
34 |
#if defined(USE_HOSTCC) /* Native for 'tools/envcrc' */ |
23ac79ff8
|
35 |
# define __UBOOT_ENV_SECTION__(name) /*XXX DO_NOT_DEL_THIS_COMMENT*/ |
c609719b8
|
36 37 38 |
#else /* Environment is embedded in U-Boot's .text section */ /* XXX - This only works with GNU C */ |
23ac79ff8
|
39 |
# define __UBOOT_ENV_SECTION__(name) __attribute__ ((section(".text."#name))) |
c609719b8
|
40 41 42 43 44 |
#endif /* * Macros to generate global absolutes. */ |
4087bc88c
|
45 |
#if defined(__bfin__) |
bd2a23ac6
|
46 47 |
# define GEN_SET_VALUE(name, value) \ asm(".set " GEN_SYMNAME(name) ", " GEN_VALUE(value)) |
4087bc88c
|
48 |
#else |
bd2a23ac6
|
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
|
57 58 |
/* |
c609719b8
|
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
|
63 |
# define ENV_CRC (~0) |
c609719b8
|
64 |
#endif |
ddd8418f7
|
65 66 |
#define DEFAULT_ENV_INSTANCE_EMBEDDED #include <env_default.h> |
0e8d15866
|
67 |
#ifdef CONFIG_ENV_ADDR_REDUND |
23ac79ff8
|
68 |
env_t redundand_environment __UBOOT_ENV_SECTION__(redundand_environment) = { |
c609719b8
|
69 70 71 72 73 74 |
0, /* CRC Sum: invalid */ 0, /* Flags: invalid */ { "\0" } }; |
0e8d15866
|
75 |
#endif /* CONFIG_ENV_ADDR_REDUND */ |
c609719b8
|
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
|
85 |
unsigned long env_size __UBOOT_ENV_SECTION__(env_size) = sizeof(env_t); |
c609719b8
|
86 87 88 89 |
/* * Add in absolutes. */ |
a09fea1d2
|
90 |
GEN_ABS(env_offset, (CONFIG_ENV_ADDR - CONFIG_SYS_FLASH_BASE)); |
a747a7f31
|
91 92 |
#endif /* ENV_IS_EMBEDDED */ |