Author Topic: codeSourcery 4.2-23 compile error  (Read 13874 times)

Offline johnr

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
codeSourcery 4.2-23 compile error
« on: August 24, 2007, 09:31:23 PM »
Hi, I just started using uTasker and downloaded SP4 and the latest loader script
and I'm trying to  compile it with codeSourcery 4.2-23 and get the followng error:

cs-make -k all
m68k-elf-gcc -mcpu=52235 -Wall -Wstrict-prototypes  -D _GNU -D _M5223X -g -c -Os ..\..\..\Hardware\M5223X\Startup_gnu.s -o Build\Startup_gnu.o
m68k-elf-gcc -mcpu=52235 -nostartfiles -Wall -Wstrict-prototypes -I..\..\uTaskerV1.3 -D _GNU -D _M5223X -g -Os -Wl,-Map=uTaskerV1.3.map -Tm52235evb-rom.ld -o uTaskerV1.3.elf Build\application.o Build\debug.o Build\webInterface.o Build\KeyScan.o Build\LCD.o Build\NetworkIndicator.o Build\Startup_gnu.o Build\M5223X.o Build\eth_drv.o Build\Driver.o Build\uMalloc.o Build\uTasker.o Build\Tty_drv.o Build\uFile.o Build\watchdog.o Build\GlobalTimer.o Build\low_power.o Build\Ethernet.o Build\arp.o Build\dhcp.o Build\dns.o Build\ftp.o Build\http.o Build\icmp.o Build\ip_utils.o Build\ip.o Build\pop3.o Build\smtp.o Build\tcp.o Build\telnet.o Build\tftp.o Build\udp.o Build\webutils.o
c:/program files/codesourcery/sourcery g++/bin/../lib/gcc/m68k-elf/4.2.0/../../../../m68k-elf/lib/m5208\libcf.a(cf-crt1.o): In function `__start1':
cf-crt1.c:(.text+0x9a): undefined reference to `_init'
cf-crt1.c:(.text+0xa0): undefined reference to `_fini'
c:/program files/codesourcery/sourcery g++/bin/../lib/gcc/m68k-elf/4.2.0/../../../../m68k-elf/lib/m5208\libc.a(lib_a-fini.o): In function `__libc_fini_array':
fini.c:(.text+0x42): undefined reference to `_fini'
collect2: ld returned 1 exit status
cs-make: *** [uTaskerV1.3.elf] Error 1
cs-make: Target `all' not remade because of errors.


 I was able to compile the Cambridge Imaging example hello world project with no problem. The updated loader script did clear up the _region array reference error in cf-crt1.c


 Thanks for any ideas,
 John


Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3068
    • View Profile
    • uTasker
Re: codeSourcery 4.2-23 compile error
« Reply #1 on: August 24, 2007, 10:23:36 PM »
Hi John

If I understand correctly you have already updated the m52235evb-rom.ld which includes the sections
__INIT_SECTION__ and __FINI_SECTION__

These were not needed until 4.2-15 (or 4.2-8 Lite). The libraries which need them do not actually get linked (i.e. are not used) but for some reason they require this at the linking stage. (In the map file they are listed with size 0)

I assume that you have the latest professional edition of CodeSourcery 4.2-23) since they presently offer still the 4.2-8 Lite for personal use.

You also write that the linking error was resolved for cf-crt1.c after using the newest linker script. It seems strange that the _fini section can be found for one but not the other file.
Presently I can't explain this.

You should be able to get direct technical support from CodeSourcery for the professional version - Personally I don't use the professional version (I experiment with 4.1.32 and sometimes 4.2-8, which doesn't allow full optimisation...) so can't test this case at the moment. Could you ask CodeSourcery (they seem very fast with answers) and fill us in on any work around?

I know that there are other users of the CS professional version (4.2-15) who may be able to offer some help in the matter (?).

Good luck

regards

Mark

P.S. In emergency the lite version should suffice (at least for first tests) - also older versions are also still available on the CS web site.



Offline johnr

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
Re: codeSourcery 4.2-23 compile error
« Reply #2 on: August 27, 2007, 06:38:40 PM »
Mark,
 I had to add the _init and _fini labels to m52235evb-rom.ld file as follows
to correct the problem

  . = ALIGN(0x4);
    __INIT_SECTION__ = . ;
   _init = . ;
    LONG (0x4e560000)   /* linkw %fp,#0 */
    *(.init)
    SHORT (0x4e5e)   /* unlk %fp */
    SHORT (0x4e75)   /* rts */

    . = ALIGN(0x4);
    __FINI_SECTION__ = . ;
    _fini = . ;
    LONG (0x4e560000)   /* linkw %fp,#0 */
    *(.fini)
    SHORT (0x4e5e)   /* unlk %fp */
    SHORT (0x4e75)   /* rts */



 John

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3068
    • View Profile
    • uTasker
Re: codeSourcery 4.2-23 compile error
« Reply #3 on: August 27, 2007, 07:04:10 PM »
Hi John

I don't understand the difference but I checked that it is accepted by the version which I am using.

The modified linker script will be included in the next service pack so that it will then be usable with all CS GCC builds.

Many thanks!

Regards

Mark

Offline johnr

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
Re: codeSourcery 4.2-23 compile error
« Reply #4 on: August 27, 2007, 09:41:45 PM »
 Mark,
 I tried debugging the code in codeSourcery after it compiled OK, but get the following error after about 30 secs running. No source code window pops up displaying where it's at in the code when the trap occurs. I did not modify any of the *.h files yet
and I'm just building uTasker without the bootloader at this point. Is that OK ?

 uTasker [C/C++ Local Application]   
   Sourcery G++ Debug Sprite for ColdFire ELF (8/27/07 4:29 PM) (Suspended)   
      Thread
  • (Suspended: Signal 'SIGTRAP' received. Description: SIGTRAP.) <Stack is not available: Target is not responding (timed out).>   

   m68k-elf-gdb (8/27/07 4:29 PM)   
   C:\Documents and Settings\jreynolds\CodeSourcery\uTasker\Applications\uTaskerV1.3\GNU_ColdFire\uTaskerV1.3.elf (8/27/07 4:29 PM)   
 

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3068
    • View Profile
    • uTasker
Re: codeSourcery 4.2-23 compile error
« Reply #5 on: August 27, 2007, 10:42:55 PM »
Hi John

I am not sure whether you mean it traps when working with the debugger or when the board is left running.

If the project works when just run and traps only when using the debugger it is very probably due to the watchdog. It is not possible to debug with the BDM when the watchdog is active - there are some simple work arounds:

1. Compile the project with disabled watchdog (not advisable)
change #define CONFIGURE_WATCHDOG         ACTIVE_WATCHDOG_2_SEC
to #define CONFIGURE_WATCHDOG                WATCHDOG_DISABLED [in app_hw_m5223x.h]

2. Set a break point at the line
    if (!WATCHDOG_DISABLE()) { in m5223x.c and then force the PC to take the branch CWCR = WATCHDOG_DISABLED;
This actually works well and is not that much work.

3. Connect the input IRQ4 with GND - this causes the code not to enable the watchdog
This is the preferred solution since it is easy to use on an eval board and there is no risk of forgetting to reactivate the watchdog later on the real board.

This is discussed in the uTasker tutorial for the M5223x (http://www.utasker.com/docs/M5223X/uTaskerV1.3-Tutorial-M5223X_003.PDF) on page 14/34.

If it is a problem that has nothing to do with the watchdog please tell me which board you are testing on and send me the SREC to that I can look at it here. I haven't used the newer Codesourcery version so can't exclude a new problem with it.

Regards

Mark

PS. The standard full build is the easiest way to start - it will generate a working project with all basic features enabled. The boot loader project is presently only available as a CodeWarrior project - to use it with GCC will require a GCC project set up. This is not a big job in itself but the project doesn't exist at the moment.
Tonight I in fact tested new boot loader features ready for a release of the SP5, which includes additional boot loader support using an external SPI FLASH and encrypted upload. The release may just be finalised tonight...

Offline johnr

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
Re: codeSourcery 4.2-23 compile error
« Reply #6 on: August 28, 2007, 02:54:48 PM »
Mark, I modified app_hw_m5223x.h to disable the WATCHDOG and set a breakpoint in fnInitHW() that checks it but it never hit it. The Debugger runs the code for about 30 secs then enters the suspended state, with the msg

(Suspended: Signal 'SIGTRAP' received. Description: SIGTRAP.) <Stack is not available: Target is not responding (timed out).>   

 The debugger is telling me the target is "Timing out" after that point when I try to
restart it etc. Attached is the S record load . I am running this on a M52233DEMO board
with a P & E USB BDM


 Thanks,
 John