EmbDev.net

Forum: ARM programming with GCC/GNU tools time.h functions


Author: Fordp (Guest)
Posted on:

Rate this post
0 useful
not useful
I have 3 questions :-

I am using winarm based on GCC 4.0.2

1) I am using mktime and gmtime_r functions in my code. They build fine
but do not link. I know this is down to a missing library, but which
library do I need ?

here is my current makefile linker code

#LIBS    = --start-group -lc -lm -lgcc -lstdc++ --end-group
LIBS    = --start-group -lc -lm -lstdc++ --end-group
LFLAGS    = -nostartfiles $(LIBS) -Map $(NAME).map -T$(LINK)

2) If I include the lstdc++ in a pure C project does it create any
overhead ?

3) The lpc_2129_newlib_cpp_20050820.zip demo has the following in the
make file

#Support for newlibc-lpc (file: libnewlibc-lpc.a)
NEWLIBLPC = -lnewlib-lpc

...

# Linker flags.
#  -Wl,...:     tell GCC to pass this to linker.
#    -Map:      create map file
#    --cref:    add cross reference to  map file
LDFLAGS = -nostartfiles -Wl,-Map=$(TARGET).map,--cref
LDFLAGS += -lc
LDFLAGS += $(NEWLIBLPC) $(MATH_LIB)
LDFLAGS += -lc -lgcc
LDFLAGS += $(CPLUSPLUS_LIB)

Where do I find the ibnewlibc-lpc.a in the Winarm package ?

All the best, and thanks to the people behind WinARM for a great
project!!!

Author: Martin Thomas (Guest)
Posted on:

Rate this post
0 useful
not useful
Fordp wrote:

(Personaly I realy prefer real full names. Anyway:)

> 1) I am using mktime and gmtime_r functions in my code. They build fine
> but do not link. I know this is down to a missing library, but which
> library do I need ?
>
> here is my current makefile linker code
>
> #LIBS    = --start-group -lc -lm -lgcc -lstdc++ --end-group
> LIBS    = --start-group -lc -lm -lstdc++ --end-group
> LFLAGS    = -nostartfiles $(LIBS) -Map $(NAME).map -T$(LINK)

Not enough information. Please give the error-message, create a simple
example-application and place it somewhere on an internet-server. AFAIK
some time-functions use a syscall to interface with the hardware,
sometimes just providing a dummy-syscall is enough to make the linker
"happy".

> 2) If I include the lstdc++ in a pure C project does it create any
> overhead ?

You can simple try yourself. Create and check the map-file for changes
after make clean all with an without the c++ library-option. When using
makefiles based on the WinARM-template (which is based on the
WinAVR-template) the summary of the memory-usage is part of the output
of make all.

> 3) The lpc_2129_newlib_cpp_20050820.zip demo has the following in the
> make file
> ...
> Where do I find the ibnewlibc-lpc.a in the Winarm package ?

Suggestion: Find it by searching for the file-name.
Start->Search->Files->search in c:\WinARM, seach for libnewlib-lpc.a
(==>arm-elf/lib/). You might want to read the readme.file for WinARM
3/06 even if you are using an older version. The location of the library
is mentioned two times in this readme since it has been a FAQ. (I wonder
how many people do not know about the file-search function in Windows).

Martin Thomas

Author: Clifford Slocombe (clifford)
Posted on:

Rate this post
0 useful
not useful
> #LIBS    = --start-group -lc -lm -lgcc -lstdc++ --end-group
> LIBS    = --start-group -lc -lm -lstdc++ --end-group
> LFLAGS    = -nostartfiles $(LIBS) -Map $(NAME).map -T$(LINK)

You have commented out the version of LIBS that links libgcc.a - why
would you do that?

If the linker only links object code from a library if it is required to
resolve a symbol. Therefore if you have not used C++ the presence of
libstdc++ will not affect the final code. It could conceivably extend
the build marginally time if the linker has to iterate the group more
than once.

Clifford

Author: Fordp (Guest)
Posted on:

Rate this post
0 useful
not useful
Martin Thomas wrote:
> Not enough information. Please give the error-message, create a simple
> example-application and place it somewhere on an internet-server. AFAIK
> some time-functions use a syscall to interface with the hardware,
> sometimes just providing a dummy-syscall is enough to make the linker
> "happy".

The calls I am making are c library calls and are abstract and do not
relate to the hardware. The error messages are
1) undefined reference to `mktime'
2) undefined reference to `gmtime_r'

Martin Thomas wrote:
>
>> 2) If I include the lstdc++ in a pure C project does it create any
>> overhead ?
>
> You can simple try yourself. Create and check the map-file for changes
> after make clean all with an without the c++ library-option. When using
> makefiles based on the WinARM-template (which is based on the
> WinAVR-template) the summary of the memory-usage is part of the output
> of make all.

I must admit I find the map file very hard to read. I know librarys do
not normally increase the size code where no use is made of them, but I
have no idea why the demo's do not include all the librarys so when the
demo's are extended by users it does not "just work" tm ;).

Martin Thomas wrote:
>> 3) The lpc_2129_newlib_cpp_20050820.zip demo has the following in the
>> make file
>> ...
>> Where do I find the ibnewlibc-lpc.a in the Winarm package ?
>
> Suggestion: Find it by searching for the file-name.
> Start->Search->Files->search in c:\WinARM, seach for libnewlib-lpc.a
> (==>arm-elf/lib/). You might want to read the readme.file for WinARM
> 3/06 even if you are using an older version. The location of the library
> is mentioned two times in this readme since it has been a FAQ. (I wonder
> how many people do not know about the file-search function in Windows).
>
> Martin Thomas
I would be surprised too if a programmer did not know about this, I
certainly do and I did search for this library, and it was not there. I
even did it from a command propmt.

Here is my output :-

C:\WinARM>dir *.a /s
 Volume in drive C has no label.
 Volume Serial Number is 8016-5CBD

 Directory of C:\WinARM\arm-elf\lib

14/01/2006  02:03           538,554 libc.a
14/01/2006  02:03           538,554 libg.a
14/01/2006  04:32           557,648 libiberty.a
14/01/2006  02:03           343,992 libm.a
14/01/2006  02:04            22,218 libnosys.a
14/01/2006  02:04            28,102 librdimon.a
14/01/2006  02:04            24,644 librdpmon.a
14/01/2006  04:25         4,666,504 libstdc++.a
14/01/2006  04:25           315,766 libsupc++.a
               9 File(s)      7,035,982 bytes

 Directory of C:\WinARM\arm-elf\lib\be

14/01/2006  02:03           536,734 libc.a
14/01/2006  02:03           536,734 libg.a
14/01/2006  04:32           557,832 libiberty.a
14/01/2006  02:03           344,328 libm.a
14/01/2006  02:04            22,218 libnosys.a
14/01/2006  02:04            28,118 librdimon.a
14/01/2006  02:04            24,652 librdpmon.a
14/01/2006  04:26         4,668,202 libstdc++.a
14/01/2006  04:26           316,216 libsupc++.a
               9 File(s)      7,035,034 bytes

 Directory of C:\WinARM\arm-elf\lib\be\fpu

14/01/2006  02:03           531,696 libc.a
14/01/2006  02:03           531,696 libg.a
14/01/2006  04:32           556,924 libiberty.a
14/01/2006  02:03           264,040 libm.a
14/01/2006  02:04            22,218 libnosys.a
14/01/2006  02:04            28,126 librdimon.a
14/01/2006  02:04            24,660 librdpmon.a
14/01/2006  04:29         4,685,580 libstdc++.a
14/01/2006  04:29           317,342 libsupc++.a
               9 File(s)      6,962,282 bytes

 Directory of C:\WinARM\arm-elf\lib\be\fpu\interwork

14/01/2006  02:04           533,964 libc.a
14/01/2006  02:04           533,964 libg.a
14/01/2006  04:32           559,160 libiberty.a
14/01/2006  02:04           264,504 libm.a
14/01/2006  02:04            22,218 libnosys.a
14/01/2006  02:04            28,166 librdimon.a
14/01/2006  02:04            24,804 librdpmon.a
14/01/2006  04:30         4,699,738 libstdc++.a
14/01/2006  04:30           319,280 libsupc++.a
               9 File(s)      6,985,798 bytes

 Directory of C:\WinARM\arm-elf\lib\be\fpu\nofmult

14/01/2006  02:04           537,720 libc.a
14/01/2006  02:04           537,720 libg.a
14/01/2006  04:32           556,688 libiberty.a
14/01/2006  02:04           264,302 libm.a
14/01/2006  02:04            22,218 libnosys.a
14/01/2006  02:04            28,150 librdimon.a
14/01/2006  02:04            24,696 librdpmon.a
14/01/2006  04:30         4,708,422 libstdc++.a
14/01/2006  04:30           318,632 libsupc++.a
               9 File(s)      6,998,548 bytes

 Directory of C:\WinARM\arm-elf\lib\be\interwork

14/01/2006  02:04           539,022 libc.a
14/01/2006  02:04           539,022 libg.a
14/01/2006  04:32           560,104 libiberty.a
14/01/2006  02:04           344,836 libm.a
14/01/2006  02:04            22,218 libnosys.a
14/01/2006  02:04            28,150 librdimon.a
14/01/2006  02:04            24,788 librdpmon.a
14/01/2006  04:29         4,682,368 libstdc++.a
14/01/2006  04:29           318,134 libsupc++.a
               9 File(s)      7,058,642 bytes

 Directory of C:\WinARM\arm-elf\lib\be\nofmult

14/01/2006  02:04           542,970 libc.a
14/01/2006  02:04           542,970 libg.a
14/01/2006  04:32           557,496 libiberty.a
14/01/2006  02:04           344,456 libm.a
14/01/2006  02:04            22,218 libnosys.a
14/01/2006  02:04            28,142 librdimon.a
14/01/2006  02:04            24,688 librdpmon.a
14/01/2006  04:29         4,689,076 libstdc++.a
14/01/2006  04:29           317,410 libsupc++.a
               9 File(s)      7,069,426 bytes

 Directory of C:\WinARM\arm-elf\lib\fpu

14/01/2006  02:03           533,604 libc.a
14/01/2006  02:03           533,604 libg.a
14/01/2006  04:32           556,872 libiberty.a
14/01/2006  02:03           264,020 libm.a
14/01/2006  02:04            22,218 libnosys.a
14/01/2006  02:04            28,118 librdimon.a
14/01/2006  02:04            24,660 librdpmon.a
14/01/2006  04:27         4,683,890 libstdc++.a
14/01/2006  04:27           316,904 libsupc++.a
               9 File(s)      6,963,890 bytes

 Directory of C:\WinARM\arm-elf\lib\fpu\interwork

14/01/2006  02:03           535,872 libc.a
14/01/2006  02:03           535,872 libg.a
14/01/2006  04:32           559,052 libiberty.a
14/01/2006  02:03           264,484 libm.a
14/01/2006  02:04            22,218 libnosys.a
14/01/2006  02:04            28,150 librdimon.a
14/01/2006  02:04            24,788 librdpmon.a
14/01/2006  04:28         4,698,052 libstdc++.a
14/01/2006  04:28           318,834 libsupc++.a
               9 File(s)      6,987,322 bytes

 Directory of C:\WinARM\arm-elf\lib\fpu\nofmult

14/01/2006  02:03           539,860 libc.a
14/01/2006  02:03           539,860 libg.a
14/01/2006  04:32           556,568 libiberty.a
14/01/2006  02:03           264,282 libm.a
14/01/2006  02:04            22,218 libnosys.a
14/01/2006  02:04            28,142 librdimon.a
14/01/2006  02:04            24,696 librdpmon.a
14/01/2006  04:28         4,706,280 libstdc++.a
14/01/2006  04:28           318,182 libsupc++.a
               9 File(s)      7,000,088 bytes

 Directory of C:\WinARM\arm-elf\lib\interwork

14/01/2006  02:03           540,842 libc.a
14/01/2006  02:03           540,842 libg.a
14/01/2006  04:32           559,928 libiberty.a
14/01/2006  02:03           344,500 libm.a
14/01/2006  02:04            22,218 libnosys.a
14/01/2006  02:04            28,142 librdimon.a
14/01/2006  02:04            24,780 librdpmon.a
14/01/2006  04:27         4,680,694 libstdc++.a
14/01/2006  04:27           317,692 libsupc++.a
               9 File(s)      7,059,638 bytes

 Directory of C:\WinARM\arm-elf\lib\nofmult

14/01/2006  02:03           545,014 libc.a
14/01/2006  02:03           545,014 libg.a
14/01/2006  04:32           557,344 libiberty.a
14/01/2006  02:03           344,116 libm.a
14/01/2006  02:04            22,218 libnosys.a
14/01/2006  02:04            28,126 librdimon.a
14/01/2006  02:04            24,680 librdpmon.a
14/01/2006  04:27         4,686,974 libstdc++.a
14/01/2006  04:27           316,976 libsupc++.a
               9 File(s)      7,070,462 bytes

 Directory of C:\WinARM\arm-elf\lib\thumb

14/01/2006  02:03           503,356 libc.a
14/01/2006  02:03           503,356 libg.a
14/01/2006  04:32           553,960 libiberty.a
14/01/2006  02:03           309,536 libm.a
14/01/2006  02:04            22,084 libnosys.a
14/01/2006  02:04            28,126 librdimon.a
14/01/2006  02:04            24,716 librdpmon.a
14/01/2006  04:26         4,951,170 libstdc++.a
14/01/2006  04:26           317,476 libsupc++.a
               9 File(s)      7,213,780 bytes

 Directory of C:\WinARM\arm-elf\lib\thumb\be

14/01/2006  02:04           502,404 libc.a
14/01/2006  02:04           502,404 libg.a
14/01/2006  04:32           554,536 libiberty.a
14/01/2006  02:04           309,756 libm.a
14/01/2006  02:04            22,084 libnosys.a
14/01/2006  02:04            28,142 librdimon.a
14/01/2006  02:04            24,732 librdpmon.a
14/01/2006  04:31         4,950,480 libstdc++.a
14/01/2006  04:30           317,894 libsupc++.a
               9 File(s)      7,212,432 bytes

 Directory of C:\WinARM\arm-elf\lib\thumb\be\interwork

14/01/2006  02:04           504,220 libc.a
14/01/2006  02:04           504,220 libg.a
14/01/2006  04:32           556,388 libiberty.a
14/01/2006  02:04           310,544 libm.a
14/01/2006  02:04            22,084 libnosys.a
14/01/2006  02:04            28,166 librdimon.a
14/01/2006  02:04            24,844 librdpmon.a
14/01/2006  04:31         4,958,662 libstdc++.a
14/01/2006  04:31           319,304 libsupc++.a
               9 File(s)      7,228,432 bytes

 Directory of C:\WinARM\arm-elf\lib\thumb\interwork

14/01/2006  02:04           505,168 libc.a
14/01/2006  02:04           505,168 libg.a
14/01/2006  04:32           555,844 libiberty.a
14/01/2006  02:04           310,324 libm.a
14/01/2006  02:04            22,084 libnosys.a
14/01/2006  02:04            28,150 librdimon.a
14/01/2006  02:04            24,832 librdpmon.a
14/01/2006  04:31         4,959,372 libstdc++.a
14/01/2006  04:31           318,902 libsupc++.a
               9 File(s)      7,229,844 bytes

 Directory of C:\WinARM\lib

14/01/2006  04:25         1,008,642 libiberty.a
               1 File(s)      1,008,642 bytes

 Directory of C:\WinARM\lib\gcc\arm-elf\4.0.2

14/01/2006  04:24           318,650 libgcc.a
14/01/2006  04:24            19,436 libgcov.a
14/01/2006  04:45            30,640 libnewlib-lpc.a
               3 File(s)        368,726 bytes

 Directory of C:\WinARM\lib\gcc\arm-elf\4.0.2\be

14/01/2006  04:24           317,986 libgcc.a
14/01/2006  04:24            19,436 libgcov.a
               2 File(s)        337,422 bytes

 Directory of C:\WinARM\lib\gcc\arm-elf\4.0.2\be\fpu

14/01/2006  04:24           310,574 libgcc.a
14/01/2006  04:24            19,436 libgcov.a
               2 File(s)        330,010 bytes

 Directory of C:\WinARM\lib\gcc\arm-elf\4.0.2\be\fpu\interwork

14/01/2006  04:24           310,894 libgcc.a
14/01/2006  04:24            19,436 libgcov.a
               2 File(s)        330,330 bytes

 Directory of C:\WinARM\lib\gcc\arm-elf\4.0.2\be\fpu\interwork\under

12/01/2006  20:30           318,922 libgcc.a
12/01/2006  20:30            19,404 libgcov.a
               2 File(s)        338,326 bytes

 Directory of C:\WinARM\lib\gcc\arm-elf\4.0.2\be\fpu\nofmult

14/01/2006  04:24           302,820 libgcc.a
14/01/2006  04:24            19,436 libgcov.a
               2 File(s)        322,256 bytes

 Directory of C:\WinARM\lib\gcc\arm-elf\4.0.2\be\interwork

14/01/2006  04:24           318,350 libgcc.a
14/01/2006  04:24            19,436 libgcov.a
               2 File(s)        337,786 bytes

 Directory of C:\WinARM\lib\gcc\arm-elf\4.0.2\be\nofmult

14/01/2006  04:24           310,240 libgcc.a
14/01/2006  04:24            19,436 libgcov.a
               2 File(s)        329,676 bytes

 Directory of C:\WinARM\lib\gcc\arm-elf\4.0.2\fpu

14/01/2006  04:24           311,126 libgcc.a
14/01/2006  04:24            19,436 libgcov.a
               2 File(s)        330,562 bytes

 Directory of C:\WinARM\lib\gcc\arm-elf\4.0.2\fpu\interwork

14/01/2006  04:24           311,434 libgcc.a
14/01/2006  04:24            19,436 libgcov.a
               2 File(s)        330,870 bytes

 Directory of C:\WinARM\lib\gcc\arm-elf\4.0.2\fpu\nofmult

14/01/2006  04:24           303,180 libgcc.a
14/01/2006  04:24            19,436 libgcov.a
               2 File(s)        322,616 bytes

 Directory of C:\WinARM\lib\gcc\arm-elf\4.0.2\interwork

14/01/2006  04:24           319,002 libgcc.a
14/01/2006  04:24            19,436 libgcov.a
               2 File(s)        338,438 bytes

 Directory of C:\WinARM\lib\gcc\arm-elf\4.0.2\nofmult

14/01/2006  04:24           310,708 libgcc.a
14/01/2006  04:24            19,436 libgcov.a
               2 File(s)        330,144 bytes

 Directory of C:\WinARM\lib\gcc\arm-elf\4.0.2\thumb

14/01/2006  04:24           327,446 libgcc.a
14/01/2006  04:24            19,576 libgcov.a
               2 File(s)        347,022 bytes

 Directory of C:\WinARM\lib\gcc\arm-elf\4.0.2\thumb\be

14/01/2006  04:24           327,558 libgcc.a
14/01/2006  04:24            19,576 libgcov.a
               2 File(s)        347,134 bytes

 Directory of C:\WinARM\lib\gcc\arm-elf\4.0.2\thumb\be\interwork

14/01/2006  04:24           323,962 libgcc.a
14/01/2006  04:24            19,576 libgcov.a
               2 File(s)        343,538 bytes

 Directory of C:\WinARM\lib\gcc\arm-elf\4.0.2\thumb\interwork

14/01/2006  04:24           323,858 libgcc.a
14/01/2006  04:24            19,576 libgcov.a
               2 File(s)        343,434 bytes

 Directory of C:\WinARM\utils\insight_gdb_6_4_50\lib

19/11/2005  04:46           267,408 libarm-elf-sim.a
19/11/2005  04:46           203,940 libiberty.a
19/11/2005  04:46               858 libitclstub32.a
19/11/2005  04:46               746 libitkstub32.a
19/11/2005  04:46           491,868 libpsp-sim.a
19/11/2005  04:46           552,724 libtcl84.a
19/11/2005  04:46             1,102 libtclstub84.a
19/11/2005  04:46           490,984 libtk84.a
19/11/2005  04:46             2,266 libtkstub84.a
               9 File(s)      2,011,896 bytes

     Total Files Listed:
             189 File(s)    121,860,428 bytes
               0 Dir(s)  58,793,361,408 bytes free

C:\WinARM>

Clifford Slocombe Wrote :
> You have commented out the version of LIBS that links libgcc.a - why
> would you do that?

I did that because it could not find the library.

Here is my code :-
// Access methods to read and write the LPC Clock in unix time !
// The clock does not run until it is first set

#define _REENT_ONLY
#include <time.h>
#include "lpc2103.h"

//struct tm
//{
//  int  tm_sec;
//  int  tm_min;
//  int  tm_hour;
//  int  tm_mday;
//  int  tm_mon;
//  int  tm_year;
//  int  tm_wday;
//  int  tm_yday;
//  int  tm_isdst;
//};

void init_clock(void)
{
  RTC_CIIR  = 0;        // No ints
  RTC_ALYEAR   = 0xFFF;      // Disable Alarm feature !!!
  RTC_AMR    = 0;

  if (RTC_CCR != 0x11)
  {
    RTC_CCR = 0x2;        // Hold the clock in reset until it gets a 
good time
  }
}

time_t get_time_low(void)
{
  struct tm stim;

  stim.tm_sec    = RTC_SEC;
  stim.tm_min    = RTC_MIN;
   stim.tm_hour  = RTC_HOUR;
  stim.tm_mday  = RTC_DOM;
  stim.tm_mon    = RTC_MONTH;
   stim.tm_year  = RTC_YEAR;
   stim.tm_wday  = RTC_DOW;
   stim.tm_yday  = RTC_DOY;

   stim.tm_isdst = 0;

   return   mktime(&stim);
}

time_t get_time(void)
{
  time_t result;

  do
  {
    result = get_time_low();
  }
  while (result != get_time_low());

  return result;
}

void set_time(time_t time_in)
{
  struct tm stim;

  gmtime_r(&time_in, &stim);

  RTC_CCR   = 0x2;        // Reset the clock

  RTC_SEC    = stim.tm_sec;
  RTC_MIN    = stim.tm_min;
   RTC_HOUR  = stim.tm_hour;
  RTC_DOM    = stim.tm_mday;
  RTC_MONTH  = stim.tm_mon;
   RTC_YEAR  = stim.tm_year;
   RTC_DOW    = stim.tm_wday;
   RTC_DOY    = stim.tm_yday;

   RTC_CCR    = 0x11;        // Switch on the clock !!
}

Thanks for your replys so far and thanks again for the WinARM package.

Author: Clifford Slocombe (clifford)
Posted on:

Rate this post
0 useful
not useful
Fordp wrote:
> Clifford Slocombe Wrote :
>> You have commented out the version of LIBS that links libgcc.a - why
>> would you do that?
>
> I did that because it could not find the library.
>
Well it is clearly present in the directory dump you provided. You DO
have to tell the linker where it is though! This is a case where the
'more information' that Martin requested would help. The log should
include the linker invokation as well as the resultant errors -
verbatim, not paraphrased or manually transcribed. You can cut & paste
from console windows - right-click, Mark, select with the mouse, press
enter - the text will be in the paste buffer.

For example, I have a macro in my make file that looks like this:

CLIBPATHS = -L$(WINARM_TOOLS_ROOT)/lib/gcc/arm-elf/4.0.2/interwork
-L$(WINARM_TOOLS_ROOT)/arm-elf/lib/interwork

It is used in the linker invokation to specify the paths to the correct
libraries:

$(LD) $(OBJECTS) ./lib/$(OSLIB) $(CLIBPATHS) $(LFLAGS) -o
./output/$(PROJNAME).out

 - the Thumb/ARM interwork libraries in this case, but you might use the
defaults (one folder up, or one of the other 'special' libraries.

Clifford

Author: Fordp (Guest)
Posted on:

Rate this post
0 useful
not useful
I have established that the library functions I want are implemented in
newlib.

I am still struggling to get the linker to find libgcc.a.

I am not sure the newlib stuff is in libgcc.a.

I will keep trying.

I am building for the LPC2103 and I have no thumb code at this time.

All the best.

FordP

Author: Clifford Slocombe (clifford)
Posted on:

Rate this post
0 useful
not useful
Fordp wrote:
> I have established that the library functions I want are implemented in
> newlib.
Yes thay are, newlib is implemented by libc.a and libm.a

> I am still struggling to get the linker to find libgcc.a.
>
You have not provided the requested information (a full build log)! This
will tell us exactly how you are invoking the linker. Fragments of
makefiles are not helpful, since it does not tell us the actual link
command used - an error in the makefile for example could yield
unexpected results. You are much more likely to get a resolution if you
do this! For a start it will allow me to tell you exactly what options
YOU need to set rather that give you examples of what I am setting,
which may only serve to confuse.

> I am not sure the newlib stuff is in libgcc.a.
It is not; libgcc.a contains support functions for the compiler, it is
normally required since the compiler will generate code that makes calls
to it. That is why I was surprised to see it commented out.


Clifford

Author: Fordp (Guest)
Posted on:

Rate this post
0 useful
not useful
here is my build log :-

Assembling crt.s
Compiling D505.c
Compiling interfce.c
Compiling win10.c
Compiling lpcisr.c
Compiling os2.c
Compiling i2c.c
Compiling ind_gmtm.c
Compiling clock.c
Linking d911lpc
C:/WinARM/bin/arm-elf-ld -LC:/WinARM/lib/gcc/arm-elf/4.0.2/interwork
-LC:/WinARM/arm-elf/lib/interwork -nostartfiles --start-group -lc -lm
-lstdc++ -lgcc --end-group -Map d911lpc.map -Tlpc2103_flash.cmd -o
d911lpc.out crt.o D505.o dali15.o interfce.o win10.o lpcisr.o os2.o
i2c.o ind_gmtm.o clock.o
clock.o: In function `get_time_low':C:\Documents and
Settings\SimonE\Eclipse_Workspace\D911LPC/clock.c:299: undefined
reference to `mktime'
clock.o: In function `set_time':C:\Documents and
Settings\SimonE\Eclipse_Workspace\D911LPC/clock.c:319: undefined
reference to `gmtime_r'
make: *** [d911lpc.out] Error 1
make: Target `all' not remade because of errors.

I modified my makefile to show the linker command line. If I had just
sent my normal build log it would have said nothing useful.

I think you will agree it shows that libc.a and libm.a are in there so
assuming they are the correct librarys then they should contain mktime
and gmtime_r. I have already posted my code previously, at least the
module with problems.

The code I posted should build fine on any chip in the range LPC2101 to
LPC2106, I have not looked at others at this time.

You should be able to add the module above to any suitable project and
get the results as I do.

Please note the rest of my code is deeply embedded and so has little use
for any librarys. This time/date convertion is the expception in my
code.

Thank you for your help so far.

Clifford Slocombe wrote:
> Fordp wrote:
>> I have established that the library functions I want are implemented in
>> newlib.
> Yes thay are, newlib is implemented by libc.a and libm.a
>
>> I am still struggling to get the linker to find libgcc.a.
>>
> You have not provided the requested information (a full build log)! This
> will tell us exactly how you are invoking the linker. Fragments of
> makefiles are not helpful, since it does not tell us the actual link
> command used - an error in the makefile for example could yield
> unexpected results. You are much more likely to get a resolution if you
> do this! For a start it will allow me to tell you exactly what options
> YOU need to set rather that give you examples of what I am setting,
> which may only serve to confuse.
>
>> I am not sure the newlib stuff is in libgcc.a.
> It is not; libgcc.a contains support functions for the compiler, it is
> normally required since the compiler will generate code that makes calls
> to it. That is why I was surprised to see it commented out.
>
>
> Clifford

Author: Clifford Slocombe (clifford)
Posted on:

Rate this post
0 useful
not useful
Fordp wrote:
> here is my build log :-
>
Thanks, that is helpful in so far as we no longer just have to take your
word for it. ;-)  And it is also good to expose the build commands just
so you can be sure yourself what you are building and how.

I must admit that it all looks correct. The only thing I would be wary
of is spaces in paths (like "Documents and Settings"). I have seen
problems in the past with some GNU tools for Win32 not processing such
paths correctly. But this does not appear to be the problem in this
instance. Even so I'd recommend moving the project files elsewhere.

I just inspected the interwork\libc.a library with teh arm-elf-nm
utility, and it does appear to contain mktime and gmtime_r. - stumped,
sorry.

Clifford

Author: Fordp (Guest)
Posted on:

Rate this post
0 useful
not useful
I got back to my code and I have managed to make it build Hurray.

The cause of the problem seems to stem from calling arm-elf-ld directly
to perform the link.

I changed it over to link by calling arm-elf-gcc and a couple of tweaks
later it is building.

Thanks Clifford and Martin for you efforts.

Cheers.

FordP

Come on England ;)

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.