hwtimer on msb-430h

Hi,

when trying to use the hwtimer on the msb-430h I get this error during linking:

/home/milan/riot/RIOT/bin/cpu.a(hwtimer_cpu.o): In function `hwtimer_arch_init': /home/milan/riot/RIOT/cpu/msp430-common/hwtimer_cpu.c:74: undefined reference to `timerA_init' collect2: ld gab 1 als Ende-Status zur�ck make: *** [all] Fehler 1

void timerA_init(void) is defined in RIOT/cpu/msp430x16x/hwtimer_msp430.c, the build of the object was successfull.

milan@MilanDebian:~/riot/projects/hello-world$ ls -al ../../RIOT/bin/hwtimer* -rw-r--r-- 1 milan milan 752 Mai 15 10:15 ../../RIOT/bin/hwtimer_cpu.d -rw-r--r-- 1 milan milan 7676 Mai 15 10:15 ../../RIOT/bin/hwtimer_cpu.o -rw-r--r-- 1 milan milan 525 Mai 15 10:15 ../../RIOT/bin/hwtimer.d -rw-r--r-- 1 milan milan 712 Mai 15 10:15 ../../RIOT/bin/hwtimer_msp430.d -rw-r--r-- 1 milan milan 6464 Mai 15 10:15 ../../RIOT/bin/hwtimer_msp430.o -rw-r--r-- 1 milan milan 9600 Mai 15 10:15 ../../RIOT/bin/hwtimer.o

Is something missing like ar rcs $(RIOTBASE)/bin/hwtimer.a $(RIOTBASE)/bin/hwtimer*.o ? But In Makefile.modules I found:

# exclude hwtimer, because it is part of the kernel but the define is needed for auto_init export BASELIBS = $(shell echo $(BL)|sed 's/[^ ]*hwtimer.a//')

Full linker call is:

msp430-gcc /home/milan/riot/RIOT/bin/startup.o -o /home/milan/riot/projects/hello-world/bin/hello-world.elf -Wl,--start-group /home/milan/riot/RIOT/bin/posix.a /home/milan/riot/RIOT/bin/cc110x_ng.a /home/milan/riot/RIOT/bin/cc110x_spi.a /home/milan/riot/RIOT/bin/cpu.a /home/milan/riot/RIOT/bin/core.a /home/milan/riot/RIOT/bin/sys.a /home/milan/riot/RIOT/bin/transceiver.a /home/milan/riot/boards/msb-430h/bin/msb-430h_base.a /home/milan/riot/projects/hello-world/bin/hello-world.a -lm -Wl,--end-group -Wl,-Map=/home/milan/riot/projects/hello-world/bin/hello-world.map -mmcu=msp430f1612 -lgcc /home/milan/riot/RIOT/bin/startup.o

Although I am using the hello-world project here, it uses the hwtimer (the hello-world project on github does not). However same error also appears at other projects which use the hwtimer.

used gcc version is: msp430-gcc (GCC) 4.6.3 20120301 (mspgcc LTS 20120406 unpatched)

and used make version is: GNU Make 3.81

RIOT is the current git version milan@MilanDebian:~/riot/RIOT$ git show commit 336667a43ad81a147f060971a13edc2f0c34b268 Merge: d56081d 666c90f Author: Oliver Hahm <oleg@hobbykeller.org>

Can sombeody reproduce this, or has maybe even a solution?

Regards,    Milan

Hi Milan,

could you please have a look in the cpu.a file if the hwtimer_msp430.o file is present there and report back to the list?

Best regards, Heiko

Hi Heiko,

no, hwtimer_msp430.o is not present in the cpu.a

milan@MilanDebian:~/riot/RIOT/bin$ ar t cpu.a atomic.o cpu.o flashrom.o hwtimer_cpu.o irq.o msp430-main.o startup.o

I could not find how cpu.a is packed, is it done in the Makefile.base? I only found an ar call in that file.

Regards, Milan

hmm one additional note, when I change something in hwtimer_msp430.c to get it recompiled, and do not clean before, cpu.a contains hwtimer_msp320.o and the linker does not complain.

Regards, Milan

Hi Milan,

hmm one additional note, when I change something in hwtimer_msp430.c to get it recompiled, and do not clean before, cpu.a contains hwtimer_msp320.o and the linker does not complain.

I think there was a kind of race condition in the Makefile system. Both Makefiles in cpu/msp430-common and cpu/msp430x16x built a module called cpu. I guess this introduced this strange behavior.

Hence, I renamed the module in cpu/msp430-common accordingly and added it as a mandatory module in Makefile.modules.

Please pull the latest version from github and tell me if this fixed your problem.

Cheers, Oleg

Thanks Oleg,

works fine have now milan@MilanDebian:~/riot/RIOT$ ar t bin/cpu.a flashrom.o hwtimer_msp430.o

and milan@MilanDebian:~/riot/RIOT$ ar t bin/msp430_common.a atomic.o cpu.o flashrom.o hwtimer_cpu.o irq.o msp430-main.o startup.o

both linked together. BTW the two flashrom's are the same? I think one of the both should be removed, don't know if it is useful for the cc430.

Regards,    Milan

Hi Milan!

BTW the two flashrom's are the same? I think one of the both should be removed, don't know if it is useful for the cc430.

Good (and true) comment. In fact, I don't know why I copied it to msp430x16x from msp430-common. A quick look at the cc430 datasheet showed that it should work the same way there. Unfortunately, I don't have any cc430 at hand right now. Could anyone owning a cc430 check if the flashrom code works there, too?

Cheers, Oleg

Hey guys,

it appears that the hwtimer on msp430 is still buggy: https://github.com/RIOT-OS/RIOT/issues/234

Does anyone have a clue?

Cheers, Oleg