EmbDev.net

Forum: ARM programming with GCC/GNU tools Question regarding EFSL with date-and-time support


Author: roty (Guest)
Posted on:

Rate this post
0 useful
not useful
Hello,

Has anybody already generated the Embedded Filesystem Library
(libefsl.a)
with date-and-time support using the ARM-GCC?

I'm getting 6 times "Macro usage error for macro time_get...." .
Without date and time support, everything is fine.

I would not expect to get errors or warnings generating that library.
Am I missing anything ?

Is there a code example with date/time support anywhere around ?

Thanks for comments.

Author: Martin Thomas (Guest)
Posted on:

Rate this post
0 useful
not useful
roty wrote:

> Has anybody already generated the Embedded Filesystem Library
> (libefsl.a)
> with date-and-time support using the ARM-GCC?

Yes.

> I'm getting 6 times "Macro usage error for macro time_get...." .
> Without date and time support, everything is fine.

The interface-functions have to be implemented. There is currently no
default implemantation. The basic methode when using the LPC RTC could
be for example something like this (for efsl V0.2.x):

#include "LPC2xxx.h" // registers
//...
euint8  efsl_getHour(void)
{
  return (euint8)(RTCHOUR);
}

The other functions can be implemented follwing this example. See
time.h.

> I would not expect to get errors or warnings generating that library.
> Am I missing anything ?

Yes, the library does not know how to interface the RTC. RTC could be
implemented in verious ways (on LPC2000 there is a RTC-Hardware-"Cell"
with "real" Date/Time-Support, AVRs for example do not offer this) You
have to provide the interface to the real-time-clock. But it is not
difficult using the LPC2k RTC.

> Is there a code example with date/time support anywhere around ?
Currently not "around" from my side. Work in progress.

Martin Thomas

Author: roty (Guest)
Posted on:

Rate this post
0 useful
not useful
Hello

and thank you for your answer. I appreciate it very much!

Please see below.

> Martin Thomas wrote:
> The interface-functions have to be implemented. There is currently no
> default implemantation. The basic methode when using the LPC RTC could
> be for example something like this (for efsl V0.2.x):
>

I expected 6 unresolved dependencies during linking the lib to my
project as
it stated in config.h comment.
 /*
  ...
 *If the functions are not present when linking your
 * program with the library you will get unresolved dependencies.
 */

But I didn't expect macro usage errors during generating the lib, but
anyway.

> #include "LPC2xxx.h" // registers
> //...
> euint8  efsl_getHour(void)
> {
>   return (euint8)(RTCHOUR);
> }
>

That's what I already did without success. (Just with a certain return
value
for testing). Nevertheless, I'm getting the warnings.

> Yes, the library does not know how to interface the RTC. RTC could be
> implemented in verious ways (on LPC2000 there is a RTC-Hardware-"Cell"
> with "real" Date/Time-Support, AVRs for example do not offer this) You
> have to provide the interface to the real-time-clock. But it is not
> difficult using the LPC2k RTC.
>

I understand what you are saying, but I expected to provide the RTC
routines
in my project code and not in the lib code.

Maybe the precise message is helpful to recognize what's wrong. Here is
exactly
one of the messages I'm seeing:

C/C++ Indexer Problem: Macro usage error for macro : time_getHour in
file: C:\test\EFSL\efsl_027\src\time.c on line: 69.

If you have any further idea, please let me know.

Thanks a lot.

roty

Author: Martin Thomas (Guest)
Posted on:

Rate this post
0 useful
not useful
roty wrote:
> ...
> Maybe the precise message is helpful to recognize what's wrong. Here is
> exactly
> one of the messages I'm seeing:
>
> C/C++ Indexer Problem: Macro usage error for macro : time_getHour in
> file: C:\test\EFSL\efsl_027\src\time.c on line: 69.

Hmm, I have tried to reproduce this error-message without success. There
is also a chapter about time-support in the efsl-manual which may
provide useful information.

Anyway. I have just tested the time-support with the library (The code I
had already here has been rather old). The steps done:

1. used the efsl-source-code from my web-page
http://www.siwawi.arubi.uni-kl.de/avr_projects/arm...
This is a slightly modified version of the official source but the
method should work for the official code too.

2. renamed config-sample-lpc2000.h to config.h

3. removed the comment before #define DATE_TIME_SUPPORT in config.h - so
the support is enabled. Keep in mind that when using the library
compiled with this option the "interface"-functions efsl_* have to be
provided in every project which gets linked with the library. Maybe
dummys will do when no real RTC is available or time-support should not
be used.

4. compiled the library with the Makefile-LPC2000 from the archive

5. modified the example application for LPC2138 which comes in the
archive:

5a. created an additional file efsl_time_LPC.c in the same directory is
the main.c - see below

5b. added the file to the source-list in the example's makefile

5c. "make all" for the example-application with the supplied makefile
   -> no errors (output below)

So far not tested with the hardware or a simulator.

Hope this helps
Martin Thomas


--- file efsl_time_LPC.c ---
/*
  efsl Time-Support for Philips LPC21xx Controllers
  Martin THOMAS, 2006
*/

#include "LPC213x.h"
#include "types.h"
#include "time.h"

euint16 efsl_getYear(void)
{
  return (euint16)(YEAR);
}

euint8  efsl_getMonth(void)
{
  return (euint8)(MONTH);
}

euint8  efsl_getDay(void)
{
  return (euint8)(DOM);
}

euint8  efsl_getHour(void)
{
  return (euint8)(HOUR);
}

euint8  efsl_getMinute(void)
{
  return (euint8)(MIN);
}

euint8  efsl_getSecond(void)
{
  return (euint8)(SEC);
}


--- output of make all ---
 "make.exe" all

-------- begin --------
arm-elf-gcc (GCC) 4.1.1 (WinARM)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.


Assembling (ARM-only): crt0.S
arm-elf-gcc -c -mcpu=arm7tdmi-s -mthumb-interwork -I. -x
assembler-with-cpp -DROM_RUN -Wa,-adhlns=crt0.lst,-gdwarf-2 crt0.S -o
crt0.o

Compiling C: main.c
arm-elf-gcc -c -mthumb -mcpu=arm7tdmi-s -mthumb-interwork -I. -gdwarf-2
-DROM_RUN  -Os -Wall -Wcast-align -Wcast-qual -Wimplicit
-Wpointer-arith -Wswitch -Wredundant-decls -Wreturn-type -Wshadow
-Wunused -Wa,-adhlns=main.lst  -I../../inc -I../../conf -MD -MP -MF
.dep/main.o.d -Wstrict-prototypes -Wmissing-declarations
-Wmissing-prototypes -Wnested-externs  -std=gnu99 main.c -o main.o
In file included from ../../inc/efs.h:42,
                 from main.c:17:
../../inc/fs.h:169:2: warning: #warning "mt ATTR_PACKED active"

Compiling C: uart.c
arm-elf-gcc -c -mthumb -mcpu=arm7tdmi-s -mthumb-interwork -I. -gdwarf-2
-DROM_RUN  -Os -Wall -Wcast-align -Wcast-qual -Wimplicit
-Wpointer-arith -Wswitch -Wredundant-decls -Wreturn-type -Wshadow
-Wunused -Wa,-adhlns=uart.lst  -I../../inc -I../../conf -MD -MP -MF
.dep/uart.o.d -Wstrict-prototypes -Wmissing-declarations
-Wmissing-prototypes -Wnested-externs  -std=gnu99 uart.c -o uart.o

Compiling C: efsl_time_LPC.c
arm-elf-gcc -c -mthumb -mcpu=arm7tdmi-s -mthumb-interwork -I. -gdwarf-2
-DROM_RUN  -Os -Wall -Wcast-align -Wcast-qual -Wimplicit
-Wpointer-arith -Wswitch -Wredundant-decls -Wreturn-type -Wshadow
-Wunused -Wa,-adhlns=efsl_time_LPC.lst  -I../../inc -I../../conf -MD -MP
-MF .dep/efsl_time_LPC.o.d -Wstrict-prototypes -Wmissing-declarations
-Wmissing-prototypes -Wnested-externs  -std=gnu99 efsl_time_LPC.c -o
efsl_time_LPC.o

Linking: main.elf
arm-elf-gcc -mthumb -mcpu=arm7tdmi-s -mthumb-interwork -I. -gdwarf-2
-DROM_RUN  -Os -Wall -Wcast-align -Wcast-qual -Wimplicit
-Wpointer-arith -Wswitch -Wredundant-decls -Wreturn-type -Wshadow
-Wunused -Wa,-adhlns=crt0.lst  -I../../inc -I../../conf -MD -MP -MF
.dep/main.elf.d crt0.o    main.o  uart.o  efsl_time_LPC.o     --output
main.elf -nostartfiles -Wl,-Map=main.map,--cref -lc  -lm -lc -lgcc
-lefsl -L../../ -TLPC2138-ROM.ld

Creating load file for Flash: main.hex
arm-elf-objcopy -O ihex main.elf main.hex

Creating Extended Listing: main.lss
arm-elf-objdump -h -S -C main.elf > main.lss

Creating Symbol Table: main.sym
arm-elf-nm -n main.elf > main.sym

Size after:
main.elf  :
section            size         addr
.text             16636            0
.data                12   1073741824
.bss               4168   1073741836
.stack             1024   1073746176
.comment            594            0
.debug_aranges      800            0
.debug_pubnames    3779            0
.debug_info       29725            0
.debug_abbrev      6469            0
.debug_line        5559            0
.debug_frame       4644            0
.debug_str         4931            0
.debug_loc        18823            0
.debug_ranges       200            0
Total             97364



Errors: none
-------- end --------


> Process Exit Code: 0
> Time Taken: 00:02

Author: roty (Guest)
Posted on:

Rate this post
0 useful
not useful
Thanks again for helping me to find the reason for my problem.

However I found that
> C/C++ Indexer Problem: Macro usage error for macro : time_getHour in
> file: C:\test\EFSL\efsl_027\src\time.c on line: 69.
is not an ARM-GCC error message , it possibly belongs to Eclipse which
I'm
using on top of GCC.

So it seems I have to move to a different forum first.

If I know the reason, I'll post it here.

Thanks

Author: roty (Guest)
Posted on:

Rate this post
0 useful
not useful
Just a further important information.

Despite the (Eclipse) error messages, ARM-GCC generates correct code!
The errors can be ignored for the moment.

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.