[U-Boot-Users] Dynamic location of the environment sector

Angelos Manousarides amanous at inaccessnetworks.com
Thu Jun 22 12:21:54 CEST 2006

Wolfgang Denk wrote:
> In message <44997F0A.8010303 at inaccessnetworks.com> you wrote:
>>Is this a bug introduced by the workaround for the flash_addr? Or am I 
>>doing something wrong and the env_size variable should never have 
>>appeared in my code?
> You must be doing something wrong.

Ok. I found what the problem was. I was looking at the TRAB board which 
is a PXA board with the environment embedded and did exactly the same 
thing. What i did NOT notice is that it is mentioned explicitely in the 
common/environment.c file, and that is why it works and mine did not:

#if (defined(CONFIG_CMI)        || \
      defined(CONFIG_FADS)       || \
      defined(CONFIG_HYMOD)      || \
      defined(CONFIG_ICU862)     || \
      defined(CONFIG_R360MPI)    || \
      defined(CONFIG_TQM8xxL)    || \
      defined(CONFIG_RRVISION)   || \
      defined(CONFIG_TRAB)       || \
      defined(CONFIG_MRG110_6)   || \
      defined(CONFIG_PPCHAMELEONEVB) )   && \
      defined(ENV_CRC) /* Environment embedded in U-Boot .ppcenv section */
/* XXX - This only works with GNU C */
#  define __PPCENV__ __attribute__ ((section(".ppcenv")))
#  define __PPCTEXT__ __attribute__ ((section(".text")))

#elif defined(USE_HOSTCC) /* Native for 'tools/envcrc' */

#else /* Environment is embedded in U-Boot's .text section */
/* XXX - This only works with GNU C */
#  define __PPCENV__ __attribute__ ((section(".text")))
#  define __PPCTEXT__ __attribute__ ((section(".text")))

My board is not on the first #if, so it felt back to the last #else, 
thus placing the env_size and environment in the wrong order.

Angelos Manousaridis

More information about the U-Boot mailing list