All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] M5282EVB undefined reference to `environment'
@ 2011-11-21 22:00 James Steward
  2011-11-22  4:51 ` Marek Vasut
  0 siblings, 1 reply; 12+ messages in thread
From: James Steward @ 2011-11-21 22:00 UTC (permalink / raw)
  To: u-boot

Hi,

I'm trying to build U-Boot for the above mentioned board.  Basically, 
I've done the following on a Ubuntu 10.04:

wget 
https://sourcery.mentor.com/public/gnu_toolchain/m68k-elf/freescale-coldfire-4.4-215-m68k-elf-i686-pc-linux-gnu.tar.bz2

sudo tar xvfj 
freescale-coldfire-4.4-215-m68k-elf-i686-pc-linux-gnu.tar.bz2 -C /opt

export 
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/freescale-coldfire-4.4/bin

|sudo apt-get install git-core

mkdir /home/james/u-boot-git && cd ||/home/james/u-boot-git

git clone ||git://git.denx.de/u-boot-coldfire.git

||cd u-boot-coldfire
||||
||make clean

make M5282EVB_config

||make| all

At the very last stage of linking, I get...

common/libcommon.o:(.data.rel.env_ptr+0x0): undefined reference to 
`environment'
make: *** [u-boot] Error 1

Can someone help me fix this, please?

Regards,
James.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] M5282EVB undefined reference to `environment'
  2011-11-21 22:00 [U-Boot] M5282EVB undefined reference to `environment' James Steward
@ 2011-11-22  4:51 ` Marek Vasut
  2011-11-22  5:22   ` James Steward
  0 siblings, 1 reply; 12+ messages in thread
From: Marek Vasut @ 2011-11-22  4:51 UTC (permalink / raw)
  To: u-boot

> Hi,
> 
> I'm trying to build U-Boot for the above mentioned board.  Basically,
> I've done the following on a Ubuntu 10.04:
> 
> wget
> https://sourcery.mentor.com/public/gnu_toolchain/m68k-elf/freescale-coldfir
> e-4.4-215-m68k-elf-i686-pc-linux-gnu.tar.bz2
> 
> sudo tar xvfj
> freescale-coldfire-4.4-215-m68k-elf-i686-pc-linux-gnu.tar.bz2 -C /opt
> 
> export
> PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/free
> scale-coldfire-4.4/bin
> 
> |sudo apt-get install git-core
> 
> mkdir /home/james/u-boot-git && cd ||/home/james/u-boot-git
> 
> git clone ||git://git.denx.de/u-boot-coldfire.git
> 
> ||cd u-boot-coldfire
> ||
> ||make clean
> 
> make M5282EVB_config

try ./MAKEALL M5282EVB ... I suspect you don't have CROSS_COMPILE=your-crosscc-
prefix variable set, and maybe ARCH=m68k variable too.

> 
> ||make| all
> 
> At the very last stage of linking, I get...
> 
> common/libcommon.o:(.data.rel.env_ptr+0x0): undefined reference to
> `environment'
> make: *** [u-boot] Error 1
> 
> Can someone help me fix this, please?
> 
> Regards,
> James.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] M5282EVB undefined reference to `environment'
  2011-11-22  4:51 ` Marek Vasut
@ 2011-11-22  5:22   ` James Steward
  2011-11-23 12:19     ` Igor Grinberg
  0 siblings, 1 reply; 12+ messages in thread
From: James Steward @ 2011-11-22  5:22 UTC (permalink / raw)
  To: u-boot

On 22/11/11 15:51, Marek Vasut wrote:
>> Hi,
>>
>> I'm trying to build U-Boot for the above mentioned board.  Basically,
>> I've done the following on a Ubuntu 10.04:
>>
>> wget
>> https://sourcery.mentor.com/public/gnu_toolchain/m68k-elf/freescale-coldfir
>> e-4.4-215-m68k-elf-i686-pc-linux-gnu.tar.bz2
>>
>> sudo tar xvfj
>> freescale-coldfire-4.4-215-m68k-elf-i686-pc-linux-gnu.tar.bz2 -C /opt
>>
>> export
>> PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/free
>> scale-coldfire-4.4/bin
>>
>> |sudo apt-get install git-core
>>
>> mkdir /home/james/u-boot-git&&  cd ||/home/james/u-boot-git
>>
>> git clone ||git://git.denx.de/u-boot-coldfire.git
>>
>> ||cd u-boot-coldfire
>> ||
>> ||make clean
>>
>> make M5282EVB_config
>
> try ./MAKEALL M5282EVB ... I suspect you don't have CROSS_COMPILE=your-crosscc-
> prefix variable set, and maybe ARCH=m68k variable too.

I didn't have those env vars set, however now with them set, and the 
latest codesourcery compiler I get the same error;

export 
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/freescale-coldfire-2011.09/bin

export CROSS_COMPILE=m68k-elf-

export ARCH=m68k

./MAKEALL M5282EVB
Configuring for M5282EVB board...
cmd_nvedit.c: In function 'do_env_export':
cmd_nvedit.c:748:3: warning: format '%zX' expects argument of type 
'size_t', but argument 3 has type 'unsigned int' [-Wformat]
cmd_nvedit.c:774:2: warning: format '%zX' expects argument of type 
'size_t', but argument 3 has type 'unsigned int' [-Wformat]
cmd_nvedit.c: In function 'do_env_import':
cmd_nvedit.c:865:3: warning: format '%zd' expects argument of type 
'signed size_t', but argument 2 has type 'size_t' [-Wformat]
cmd_nvedit.c:865:3: warning: format '%zX' expects argument of type 
'size_t', but argument 3 has type 'unsigned int' [-Wformat]
mcfmii.c: In function 'mcffec_miiphy_write':
mcfmii.c:318:8: warning: variable 'rdreg' set but not used 
[-Wunused-but-set-variable]
common/libcommon.o:(.data.rel.env_ptr+0x0): undefined reference to 
`environment'
make: *** [u-boot] Error 1
m68k-elf-size: './u-boot': No such file

--------------------- SUMMARY ----------------------------
Boards compiled: 1
Boards with warnings or errors: 1 ( M5282EVB )
----------------------------------------------------------

Any other thoughts?  Do I need to define something to configure the 
environment to flash or something?

Regards,
James.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] M5282EVB undefined reference to `environment'
  2011-11-22  5:22   ` James Steward
@ 2011-11-23 12:19     ` Igor Grinberg
  2011-11-23 23:58       ` James Steward
  0 siblings, 1 reply; 12+ messages in thread
From: Igor Grinberg @ 2011-11-23 12:19 UTC (permalink / raw)
  To: u-boot

Hi James,

On 11/22/11 07:22, James Steward wrote:
> On 22/11/11 15:51, Marek Vasut wrote:
>>> Hi,
>>>
>>> I'm trying to build U-Boot for the above mentioned board.  Basically,
>>> I've done the following on a Ubuntu 10.04:
>>>
>>> wget
>>> https://sourcery.mentor.com/public/gnu_toolchain/m68k-elf/freescale-coldfir
>>> e-4.4-215-m68k-elf-i686-pc-linux-gnu.tar.bz2
>>>
>>> sudo tar xvfj
>>> freescale-coldfire-4.4-215-m68k-elf-i686-pc-linux-gnu.tar.bz2 -C /opt
>>>
>>> export
>>> PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/free
>>> scale-coldfire-4.4/bin
>>>
>>> |sudo apt-get install git-core
>>>
>>> mkdir /home/james/u-boot-git&&  cd ||/home/james/u-boot-git
>>>
>>> git clone ||git://git.denx.de/u-boot-coldfire.git
>>>
>>> ||cd u-boot-coldfire
>>> ||
>>> ||make clean
>>>
>>> make M5282EVB_config
>>
>> try ./MAKEALL M5282EVB ... I suspect you don't have CROSS_COMPILE=your-crosscc-
>> prefix variable set, and maybe ARCH=m68k variable too.
> 
> I didn't have those env vars set, however now with them set, and the latest codesourcery compiler I get the same error;
> 
> export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/freescale-coldfire-2011.09/bin
> 
> export CROSS_COMPILE=m68k-elf-
> 
> export ARCH=m68k
> 
> ./MAKEALL M5282EVB
> Configuring for M5282EVB board...
> cmd_nvedit.c: In function 'do_env_export':
> cmd_nvedit.c:748:3: warning: format '%zX' expects argument of type 'size_t', but argument 3 has type 'unsigned int' [-Wformat]
> cmd_nvedit.c:774:2: warning: format '%zX' expects argument of type 'size_t', but argument 3 has type 'unsigned int' [-Wformat]
> cmd_nvedit.c: In function 'do_env_import':
> cmd_nvedit.c:865:3: warning: format '%zd' expects argument of type 'signed size_t', but argument 2 has type 'size_t' [-Wformat]
> cmd_nvedit.c:865:3: warning: format '%zX' expects argument of type 'size_t', but argument 3 has type 'unsigned int' [-Wformat]
> mcfmii.c: In function 'mcffec_miiphy_write':
> mcfmii.c:318:8: warning: variable 'rdreg' set but not used [-Wunused-but-set-variable]
> common/libcommon.o:(.data.rel.env_ptr+0x0): undefined reference to `environment'
> make: *** [u-boot] Error 1
> m68k-elf-size: './u-boot': No such file
> 
> --------------------- SUMMARY ----------------------------
> Boards compiled: 1
> Boards with warnings or errors: 1 ( M5282EVB )
> ----------------------------------------------------------
> 
> Any other thoughts?  Do I need to define something to configure the environment to flash or something?

Do you have CONFIG_ENV_IS_EMBEDDED set?


-- 
Regards,
Igor.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] M5282EVB undefined reference to `environment'
  2011-11-23 12:19     ` Igor Grinberg
@ 2011-11-23 23:58       ` James Steward
  2011-11-24  6:36         ` Igor Grinberg
  0 siblings, 1 reply; 12+ messages in thread
From: James Steward @ 2011-11-23 23:58 UTC (permalink / raw)
  To: u-boot

Hi Igor,

On 23/11/11 23:19, Igor Grinberg wrote:
> Hi James,
>
> On 11/22/11 07:22, James Steward wrote:
>> On 22/11/11 15:51, Marek Vasut wrote:
>>>> Hi,
>>>>
>>>> I'm trying to build U-Boot for the above mentioned board.  Basically,
>>>> I've done the following on a Ubuntu 10.04:
>>>>
>>>> wget
>>>> https://sourcery.mentor.com/public/gnu_toolchain/m68k-elf/freescale-coldfir
>>>> e-4.4-215-m68k-elf-i686-pc-linux-gnu.tar.bz2
>>>>
>>>> sudo tar xvfj
>>>> freescale-coldfire-4.4-215-m68k-elf-i686-pc-linux-gnu.tar.bz2 -C /opt
>>>>
>>>> export
>>>> PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/free
>>>> scale-coldfire-4.4/bin
>>>>
>>>> |sudo apt-get install git-core
>>>>
>>>> mkdir /home/james/u-boot-git&&   cd ||/home/james/u-boot-git
>>>>
>>>> git clone ||git://git.denx.de/u-boot-coldfire.git
>>>>
>>>> ||cd u-boot-coldfire
>>>> ||
>>>> ||make clean
>>>>
>>>> make M5282EVB_config
>>>
>>> try ./MAKEALL M5282EVB ... I suspect you don't have CROSS_COMPILE=your-crosscc-
>>> prefix variable set, and maybe ARCH=m68k variable too.
>>
>> I didn't have those env vars set, however now with them set, and the latest codesourcery compiler I get the same error;
>>
>> export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/freescale-coldfire-2011.09/bin
>>
>> export CROSS_COMPILE=m68k-elf-
>>
>> export ARCH=m68k
>>
>> ./MAKEALL M5282EVB
>> Configuring for M5282EVB board...
>> cmd_nvedit.c: In function 'do_env_export':
>> cmd_nvedit.c:748:3: warning: format '%zX' expects argument of type 'size_t', but argument 3 has type 'unsigned int' [-Wformat]
>> cmd_nvedit.c:774:2: warning: format '%zX' expects argument of type 'size_t', but argument 3 has type 'unsigned int' [-Wformat]
>> cmd_nvedit.c: In function 'do_env_import':
>> cmd_nvedit.c:865:3: warning: format '%zd' expects argument of type 'signed size_t', but argument 2 has type 'size_t' [-Wformat]
>> cmd_nvedit.c:865:3: warning: format '%zX' expects argument of type 'size_t', but argument 3 has type 'unsigned int' [-Wformat]
>> mcfmii.c: In function 'mcffec_miiphy_write':
>> mcfmii.c:318:8: warning: variable 'rdreg' set but not used [-Wunused-but-set-variable]
>> common/libcommon.o:(.data.rel.env_ptr+0x0): undefined reference to `environment'
>> make: *** [u-boot] Error 1
>> m68k-elf-size: './u-boot': No such file
>>
>> --------------------- SUMMARY ----------------------------
>> Boards compiled: 1
>> Boards with warnings or errors: 1 ( M5282EVB )
>> ----------------------------------------------------------
>>
>> Any other thoughts?  Do I need to define something to configure the environment to flash or something?
>
> Do you have CONFIG_ENV_IS_EMBEDDED set?
>
>

A search with grep CONFIG_ENV_IS_EMBEDDED `find . -name "*.h"` indicates 
the answer is no.  Should it be set?

With grep CONFIG_ENV_IS_ `find . -name "*.h"` in 
include/configs/M5282EVB.h, I see #define CONFIG_ENV_IS_IN_FLASH	1

So looking in that file I see:

/* Configuration for environment
  * Environment is embedded in u-boot in the second sector of the flash
  */
#define CONFIG_ENV_ADDR         0xffe04000
#define CONFIG_ENV_SIZE         0x2000
#define CONFIG_ENV_IS_IN_FLASH  1

This is pure unadulterated coldfire git source that will not build out 
of the box.  I assumed I was doing something wrong.  But it seems there 
is really a bug in the default configuration for this board?

Regards,
James.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] M5282EVB undefined reference to `environment'
  2011-11-23 23:58       ` James Steward
@ 2011-11-24  6:36         ` Igor Grinberg
  2011-11-24 23:27           ` James Steward
  2011-11-25  3:52           ` [U-Boot] [Almost solved] " James Steward
  0 siblings, 2 replies; 12+ messages in thread
From: Igor Grinberg @ 2011-11-24  6:36 UTC (permalink / raw)
  To: u-boot

On 11/24/11 01:58, James Steward wrote:
> Hi Igor,
> 
> On 23/11/11 23:19, Igor Grinberg wrote:
>> Hi James,
>>
>> On 11/22/11 07:22, James Steward wrote:
>>> On 22/11/11 15:51, Marek Vasut wrote:
>>>>> Hi,
>>>>>
>>>>> I'm trying to build U-Boot for the above mentioned board.  Basically,
>>>>> I've done the following on a Ubuntu 10.04:
>>>>>
>>>>> wget
>>>>> https://sourcery.mentor.com/public/gnu_toolchain/m68k-elf/freescale-coldfir
>>>>> e-4.4-215-m68k-elf-i686-pc-linux-gnu.tar.bz2
>>>>>
>>>>> sudo tar xvfj
>>>>> freescale-coldfire-4.4-215-m68k-elf-i686-pc-linux-gnu.tar.bz2 -C /opt
>>>>>
>>>>> export
>>>>> PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/free
>>>>> scale-coldfire-4.4/bin
>>>>>
>>>>> |sudo apt-get install git-core
>>>>>
>>>>> mkdir /home/james/u-boot-git&&   cd ||/home/james/u-boot-git
>>>>>
>>>>> git clone ||git://git.denx.de/u-boot-coldfire.git
>>>>>
>>>>> ||cd u-boot-coldfire
>>>>> ||
>>>>> ||make clean
>>>>>
>>>>> make M5282EVB_config
>>>>
>>>> try ./MAKEALL M5282EVB ... I suspect you don't have CROSS_COMPILE=your-crosscc-
>>>> prefix variable set, and maybe ARCH=m68k variable too.
>>>
>>> I didn't have those env vars set, however now with them set, and the latest codesourcery compiler I get the same error;
>>>
>>> export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/freescale-coldfire-2011.09/bin
>>>
>>> export CROSS_COMPILE=m68k-elf-
>>>
>>> export ARCH=m68k
>>>
>>> ./MAKEALL M5282EVB
>>> Configuring for M5282EVB board...
>>> cmd_nvedit.c: In function 'do_env_export':
>>> cmd_nvedit.c:748:3: warning: format '%zX' expects argument of type 'size_t', but argument 3 has type 'unsigned int' [-Wformat]
>>> cmd_nvedit.c:774:2: warning: format '%zX' expects argument of type 'size_t', but argument 3 has type 'unsigned int' [-Wformat]
>>> cmd_nvedit.c: In function 'do_env_import':
>>> cmd_nvedit.c:865:3: warning: format '%zd' expects argument of type 'signed size_t', but argument 2 has type 'size_t' [-Wformat]
>>> cmd_nvedit.c:865:3: warning: format '%zX' expects argument of type 'size_t', but argument 3 has type 'unsigned int' [-Wformat]
>>> mcfmii.c: In function 'mcffec_miiphy_write':
>>> mcfmii.c:318:8: warning: variable 'rdreg' set but not used [-Wunused-but-set-variable]
>>> common/libcommon.o:(.data.rel.env_ptr+0x0): undefined reference to `environment'
>>> make: *** [u-boot] Error 1
>>> m68k-elf-size: './u-boot': No such file
>>>
>>> --------------------- SUMMARY ----------------------------
>>> Boards compiled: 1
>>> Boards with warnings or errors: 1 ( M5282EVB )
>>> ----------------------------------------------------------
>>>
>>> Any other thoughts?  Do I need to define something to configure the environment to flash or something?
>>
>> Do you have CONFIG_ENV_IS_EMBEDDED set?
>>
>>
> 
> A search with grep CONFIG_ENV_IS_EMBEDDED `find . -name "*.h"` indicates the answer is no.  Should it be set?

AFAIK, environment variable is used only when you have ENV_IS_EMBEDDED set.
Also, there is some logic in the include/environment.h files
(in current master line 64), that decides whether to set this
automatically or not.

> 
> With grep CONFIG_ENV_IS_ `find . -name "*.h"` in include/configs/M5282EVB.h, I see #define CONFIG_ENV_IS_IN_FLASH    1
> 
> So looking in that file I see:
> 
> /* Configuration for environment
>  * Environment is embedded in u-boot in the second sector of the flash
>  */
> #define CONFIG_ENV_ADDR         0xffe04000
> #define CONFIG_ENV_SIZE         0x2000
> #define CONFIG_ENV_IS_IN_FLASH  1

Look at the logic in environment.h to check if ENV_IS_EMBEDDED
gets set in your case.

> 
> This is pure unadulterated coldfire git source that will not build out of the box.  I assumed I was doing something wrong.  But it seems there is really a bug in the default configuration for this board?

Could be... It is extremely hard to understand what's going on
when the source code is a kind of divergence from upstream.
Also, there is a possibility that ENV_IS_EMBEDDED is broken
for some time already.


-- 
Regards,
Igor.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] M5282EVB undefined reference to `environment'
  2011-11-24  6:36         ` Igor Grinberg
@ 2011-11-24 23:27           ` James Steward
  2011-11-25  5:42             ` Wolfgang Denk
  2011-11-25  3:52           ` [U-Boot] [Almost solved] " James Steward
  1 sibling, 1 reply; 12+ messages in thread
From: James Steward @ 2011-11-24 23:27 UTC (permalink / raw)
  To: u-boot

On 24/11/11 17:36, Igor Grinberg wrote:
> On 11/24/11 01:58, James Steward wrote:
>> Hi Igor,
>>
>> On 23/11/11 23:19, Igor Grinberg wrote:
>>> Hi James,
>>>
>>> On 11/22/11 07:22, James Steward wrote:
>>>> On 22/11/11 15:51, Marek Vasut wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I'm trying to build U-Boot for the above mentioned board.  Basically,
>>>>>> I've done the following on a Ubuntu 10.04:
>>>>>>
>>>>>> wget
>>>>>> https://sourcery.mentor.com/public/gnu_toolchain/m68k-elf/freescale-coldfir
>>>>>> e-4.4-215-m68k-elf-i686-pc-linux-gnu.tar.bz2
>>>>>>
>>>>>> sudo tar xvfj
>>>>>> freescale-coldfire-4.4-215-m68k-elf-i686-pc-linux-gnu.tar.bz2 -C /opt
>>>>>>
>>>>>> export
>>>>>> PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/free
>>>>>> scale-coldfire-4.4/bin
>>>>>>
>>>>>> |sudo apt-get install git-core
>>>>>>
>>>>>> mkdir /home/james/u-boot-git&&    cd ||/home/james/u-boot-git
>>>>>>
>>>>>> git clone ||git://git.denx.de/u-boot-coldfire.git
>>>>>>
>>>>>> ||cd u-boot-coldfire
>>>>>> ||
>>>>>> ||make clean
>>>>>>
>>>>>> make M5282EVB_config
>>>>>
>>>>> try ./MAKEALL M5282EVB ... I suspect you don't have CROSS_COMPILE=your-crosscc-
>>>>> prefix variable set, and maybe ARCH=m68k variable too.
>>>>
>>>> I didn't have those env vars set, however now with them set, and the latest codesourcery compiler I get the same error;
>>>>
>>>> export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/freescale-coldfire-2011.09/bin
>>>>
>>>> export CROSS_COMPILE=m68k-elf-
>>>>
>>>> export ARCH=m68k
>>>>
>>>> ./MAKEALL M5282EVB
>>>> Configuring for M5282EVB board...
>>>> cmd_nvedit.c: In function 'do_env_export':
>>>> cmd_nvedit.c:748:3: warning: format '%zX' expects argument of type 'size_t', but argument 3 has type 'unsigned int' [-Wformat]
>>>> cmd_nvedit.c:774:2: warning: format '%zX' expects argument of type 'size_t', but argument 3 has type 'unsigned int' [-Wformat]
>>>> cmd_nvedit.c: In function 'do_env_import':
>>>> cmd_nvedit.c:865:3: warning: format '%zd' expects argument of type 'signed size_t', but argument 2 has type 'size_t' [-Wformat]
>>>> cmd_nvedit.c:865:3: warning: format '%zX' expects argument of type 'size_t', but argument 3 has type 'unsigned int' [-Wformat]
>>>> mcfmii.c: In function 'mcffec_miiphy_write':
>>>> mcfmii.c:318:8: warning: variable 'rdreg' set but not used [-Wunused-but-set-variable]
>>>> common/libcommon.o:(.data.rel.env_ptr+0x0): undefined reference to `environment'
>>>> make: *** [u-boot] Error 1
>>>> m68k-elf-size: './u-boot': No such file
>>>>
>>>> --------------------- SUMMARY ----------------------------
>>>> Boards compiled: 1
>>>> Boards with warnings or errors: 1 ( M5282EVB )
>>>> ----------------------------------------------------------
>>>>
>>>> Any other thoughts?  Do I need to define something to configure the environment to flash or something?
>>>
>>> Do you have CONFIG_ENV_IS_EMBEDDED set?
>>>
>>>
>>
>> A search with grep CONFIG_ENV_IS_EMBEDDED `find . -name "*.h"` indicates the answer is no.  Should it be set?
>
> AFAIK, environment variable is used only when you have ENV_IS_EMBEDDED set.
> Also, there is some logic in the include/environment.h files
> (in current master line 64), that decides whether to set this
> automatically or not.
>
>>
>> With grep CONFIG_ENV_IS_ `find . -name "*.h"` in include/configs/M5282EVB.h, I see #define CONFIG_ENV_IS_IN_FLASH    1
>>
>> So looking in that file I see:
>>
>> /* Configuration for environment
>>   * Environment is embedded in u-boot in the second sector of the flash
>>   */
>> #define CONFIG_ENV_ADDR         0xffe04000
>> #define CONFIG_ENV_SIZE         0x2000
>> #define CONFIG_ENV_IS_IN_FLASH  1
>
> Look at the logic in environment.h to check if ENV_IS_EMBEDDED
> gets set in your case.


Indeed...

# if (CONFIG_ENV_ADDR >= CONFIG_SYS_MONITOR_BASE) && \
      (CONFIG_ENV_ADDR+CONFIG_ENV_SIZE) <= (CONFIG_SYS_MONITOR_BASE + 
CONFIG_SYS_MONITOR_LEN)
#  define ENV_IS_EMBEDDED       1
#error "Defining ENV_IS_EMBEDDED"
# endif

produces

include/environment.h:66:2: error: #error "Defining ENV_IS_EMBEDDED"

So this is saying that if the environment exists within the flash space 
allocated to u-boot, make it so embedded.  Ok, fine, so in 
common/env_flash.c I see;

#ifdef ENV_IS_EMBEDDED
env_t *env_ptr = &environment;

static env_t *flash_addr = (env_t *)CONFIG_ENV_ADDR;

#else /* ! ENV_IS_EMBEDDED */

I guess the variable environment is not defined, but where should it be 
defined?  There are a lot of hits when I search.

>>
>> This is pure unadulterated coldfire git source that will not build out of the box.  I assumed I was doing something wrong.  But it seems there is really a bug in the default configuration for this board?
>
> Could be... It is extremely hard to understand what's going on
> when the source code is a kind of divergence from upstream.
> Also, there is a possibility that ENV_IS_EMBEDDED is broken
> for some time already.
>
>

Ok, I just grabbed u-boot.git instead and ...

common/libcommon.o:(.data.rel.env_ptr+0x0): undefined reference to 
`environment'

Where do I look next?

General remark and question:

After building a multitude of open source projects for x86 and cross 
compiling for ARM, including cross compiling the Linux kernel and 
writing some simple kernel drivers, and writing bare metal code for the 
likes of the STM32 and including CanFestival, for example, U-boot has 
been the most frustrating and difficult project for me to build and make 
work of all.  Is it because there are too many board ports contributed 
but not maintained?

Regards,
James.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [Almost solved] M5282EVB undefined reference to `environment'
  2011-11-24  6:36         ` Igor Grinberg
  2011-11-24 23:27           ` James Steward
@ 2011-11-25  3:52           ` James Steward
  2011-11-29 22:58             ` James Steward
  1 sibling, 1 reply; 12+ messages in thread
From: James Steward @ 2011-11-25  3:52 UTC (permalink / raw)
  To: u-boot

On 24/11/11 17:36, Igor Grinberg wrote:
> On 11/24/11 01:58, James Steward wrote:
>> A search with grep CONFIG_ENV_IS_EMBEDDED `find . -name "*.h"`
>> indicates the answer is no.  Should it be set?
>
> AFAIK, environment variable is used only when you have
> ENV_IS_EMBEDDED set. Also, there is some logic in the
> include/environment.h files (in current master line 64), that decides
> whether to set this automatically or not.
>
>>
>> With grep CONFIG_ENV_IS_ `find . -name "*.h"` in
>> include/configs/M5282EVB.h, I see #define CONFIG_ENV_IS_IN_FLASH
>> 1
>>
>> So looking in that file I see:
>>
>> /* Configuration for environment * Environment is embedded in
>> u-boot in the second sector of the flash */ #define CONFIG_ENV_ADDR
>> 0xffe04000 #define CONFIG_ENV_SIZE         0x2000 #define
>> CONFIG_ENV_IS_IN_FLASH  1
>
> Look at the logic in environment.h to check if ENV_IS_EMBEDDED gets
> set in your case.

objdump -t common/env_embedded.o | grep environment
00000004 g     O .text	00002000 environment

objdump -t common/libcommon.o | grep environment
00000000 l    d  .rodata.default_environment	00000000 
.rodata.default_environment

00000000         *UND*	00000000 environment

00000000 g     O .rodata.default_environment	00000163 default_environment

So environment is undefined in libcommon.o, but is in env_embedded.o.

 From make all I see;

m68k-elf-ld  -n -r -o libcommon.o  cmd_bdinfo.o cmd_boot.o cmd_bootm.o 
cmd_cache.o cmd_console.o cmd_echo.o cmd_flash.o cmd_help.o cmd_itest.o 
cmd_load.o cmd_mem.o cmd_mii.o cmd_misc.o cmd_net.o cmd_nvedit.o 
cmd_pcmcia.o cmd_source.o cmd_version.o cmd_ximg.o command.o console.o 
dlmalloc.o env_common.o env_flash.o exports.o flash.o image.o main.o 
memsize.o miiphyutil.o s_record.o stdio.o xyzModem.o

So it compiles env_embedded.c, but doesn't include it in libcommon.o?

<hack>
vim common/Makefile

XCOBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_embedded.o

becomes

COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_embedded.o

:q
</hack>

make all

Hey, presto, build now completes!

So how should this be corrected properly?

Regards,
James.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] M5282EVB undefined reference to `environment'
  2011-11-24 23:27           ` James Steward
@ 2011-11-25  5:42             ` Wolfgang Denk
  0 siblings, 0 replies; 12+ messages in thread
From: Wolfgang Denk @ 2011-11-25  5:42 UTC (permalink / raw)
  To: u-boot

Dear James Steward,

In message <4ECED2F2.8040309@inchipdesign.com.au> you wrote:
>
> I guess the variable environment is not defined, but where should it be 
> defined?  There are a lot of hits when I search.

When embedding the environment, you must set up a specific memory mep.
This is done in the linker script, so this definition is usually found
there.

> After building a multitude of open source projects for x86 and cross 
> compiling for ARM, including cross compiling the Linux kernel and 
> writing some simple kernel drivers, and writing bare metal code for the 
> likes of the STM32 and including CanFestival, for example, U-boot has 
> been the most frustrating and difficult project for me to build and make 
> work of all.  Is it because there are too many board ports contributed 
> but not maintained?

Out-of-tree code is always a pain. But the real problem comes from the
complexity of the hardware we have to deal with in the boot loader.
After all, we have to do all the low-level initializations all higher
software levels (including Linux) just take for granted.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
    \|/ ____ \|/                                     \|/ ____ \|/
     @~/ ,. \~@                                       @~/ ,. \~@
    /_( \__/ )_\                                     /_( \__/ )_\
       \__U_/                                           \__U_/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [Almost solved] M5282EVB undefined reference to `environment'
  2011-11-25  3:52           ` [U-Boot] [Almost solved] " James Steward
@ 2011-11-29 22:58             ` James Steward
  2011-11-30  6:58               ` Igor Grinberg
  0 siblings, 1 reply; 12+ messages in thread
From: James Steward @ 2011-11-29 22:58 UTC (permalink / raw)
  To: u-boot

On 25/11/11 14:52, James Steward wrote:

> So it compiles env_embedded.c, but doesn't include it in libcommon.o?
>
> <hack>
> vim common/Makefile
>
> XCOBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_embedded.o
>
> becomes
>
> COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_embedded.o
>
> :q
> </hack>
>
> make all
>
> Hey, presto, build now completes!
>
> So how should this be corrected properly?

Can anyone suggest how the build process should be fixed?

Regards,
James.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [Almost solved] M5282EVB undefined reference to `environment'
  2011-11-29 22:58             ` James Steward
@ 2011-11-30  6:58               ` Igor Grinberg
  2011-11-30 21:10                 ` James Steward
  0 siblings, 1 reply; 12+ messages in thread
From: Igor Grinberg @ 2011-11-30  6:58 UTC (permalink / raw)
  To: u-boot

On 11/30/11 00:58, James Steward wrote:
> On 25/11/11 14:52, James Steward wrote:
> 
>> So it compiles env_embedded.c, but doesn't include it in libcommon.o?
>>
>> <hack>
>> vim common/Makefile
>>
>> XCOBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_embedded.o
>>
>> becomes
>>
>> COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_embedded.o
>>
>> :q
>> </hack>
>>
>> make all
>>
>> Hey, presto, build now completes!
>>
>> So how should this be corrected properly?
> 
> Can anyone suggest how the build process should be fixed?

I don't fully understand the logic behind what's done
to have ENV_IS_EMBEDDED, as it is used mostly on architectures
I haven't worked with (at least till now).
So, probably, I will not be the right person to ask...

My suggestion would be to look into those linker scripts,
Wolfgang mentioned in one of the previous emails and if you think
it should be done in some different way, send a patch and start
a discussion. But, really, I'm not the right person to ask...


-- 
Regards,
Igor.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [Almost solved] M5282EVB undefined reference to `environment'
  2011-11-30  6:58               ` Igor Grinberg
@ 2011-11-30 21:10                 ` James Steward
  0 siblings, 0 replies; 12+ messages in thread
From: James Steward @ 2011-11-30 21:10 UTC (permalink / raw)
  To: u-boot

On 30/11/11 17:58, Igor Grinberg wrote:
> On 11/30/11 00:58, James Steward wrote:
>> On 25/11/11 14:52, James Steward wrote:
>>
>>> So it compiles env_embedded.c, but doesn't include it in libcommon.o?
>>>
>>> <hack>
>>> vim common/Makefile
>>>
>>> XCOBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_embedded.o
>>>
>>> becomes
>>>
>>> COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_embedded.o
>>>
>>> :q
>>> </hack>
>>>
>>> make all
>>>
>>> Hey, presto, build now completes!
>>>
>>> So how should this be corrected properly?
>>
>> Can anyone suggest how the build process should be fixed?
>
> I don't fully understand the logic behind what's done
> to have ENV_IS_EMBEDDED, as it is used mostly on architectures
> I haven't worked with (at least till now).
> So, probably, I will not be the right person to ask...
>
> My suggestion would be to look into those linker scripts,
> Wolfgang mentioned in one of the previous emails and if you think
> it should be done in some different way, send a patch and start
> a discussion. But, really, I'm not the right person to ask...
>
>

Thanks for your help so far, Igor.  I'm going to unsubscribe from this 
list as the volume of email is huge and mostly not interesting to me. 
If I come up with a possible solution, I'll subscribe and send a patch.

Regards,
James.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2011-11-30 21:10 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-21 22:00 [U-Boot] M5282EVB undefined reference to `environment' James Steward
2011-11-22  4:51 ` Marek Vasut
2011-11-22  5:22   ` James Steward
2011-11-23 12:19     ` Igor Grinberg
2011-11-23 23:58       ` James Steward
2011-11-24  6:36         ` Igor Grinberg
2011-11-24 23:27           ` James Steward
2011-11-25  5:42             ` Wolfgang Denk
2011-11-25  3:52           ` [U-Boot] [Almost solved] " James Steward
2011-11-29 22:58             ` James Steward
2011-11-30  6:58               ` Igor Grinberg
2011-11-30 21:10                 ` James Steward

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.