MOD-PULSE compilation with MSP-gcc

Started by antoine-bioS, March 03, 2014, 04:41:36 PM

Previous topic - Next topic

antoine-bioS

Hello,

I am interested in buying the MOD-PULSE, but before buying it I wanted to be sure I can compile the code provided with it.
As IAR is a little bit expensive, I tried to compile with MSP-GCC. I followed this tuto to install it : http://skyduino.wordpress.com/2012/02/28/tutoriel-compilation-dune-toolchain-msp430-pour-windows-exemple-blink-sur-une-carte-launchpad/ (it's in french language)
But when I try to compile, I have this error message
C:\....\MOD-PULSE_DemoSoft-IAR-for-MSP-v4.21\MOD-PULSE_Example>msp430-gcc -Wall -Os MOD-PULSE.c -o MOD-PULSE.out
c:/mingw/bin/../lib/gcc/msp430/4.6.3/../../../../msp430/bin/ld.exe: cannot open
linker script file memory.x: No such file or directory
collect2: ld returned 1 exit status


So I tried with another command, more specific with the MSP :

C:\....\MOD-PULSE_DemoSoft-IAR-for-MSP-v4.21\MOD-PULSE_Example>msp430-gcc -mmcu=msp430fg439 -Wall -Os MOD-PULSE.c -o MOD-PULSE.out
C:\Users\BIOSER~1\AppData\Local\Temp\cc6yp7nI.o: In function `ir_filter':
MOD-PULSE.c:(.text+0xb4): undefined reference to `mul16'
MOD-PULSE.c:(.text+0xe6): undefined reference to `mul16'
C:\Users\BIOSER~1\AppData\Local\Temp\cc6yp7nI.o: In function `vs_filter':
MOD-PULSE.c:(.text+0x152): undefined reference to `mul16'
MOD-PULSE.c:(.text+0x184): undefined reference to `mul16'
C:\Users\BIOSER~1\AppData\Local\Temp\cc6yp7nI.o: In function `__isr_6':
MOD-PULSE.c:(.text+0x34a): undefined reference to `mul16'
C:\Users\BIOSER~1\AppData\Local\Temp\cc6yp7nI.o:MOD-PULSE.c:(.text+0x586): more
undefined references to `mul16' follow
C:\Users\BIOSER~1\AppData\Local\Temp\cc6yp7nI.o: In function `main':
MOD-PULSE.c:(.init9+0x1b6): undefined reference to `log'
MOD-PULSE.c:(.init9+0x1c6): undefined reference to `log'
collect2: ld returned 1 exit status


I looked in many forums but I did not find the same error so I'm asking you if someone can explain me where I am wrong, and what I can do to compile this code.

Thank you for your help, and sorry for my bad English, I'm French :)

Best regards,

Antoine

antoine-bioS

#1
Ok if anyone is interested, a coworker of mine helped me to solve the problem.

First I have to add this line :

int32_t mul16(int16_t x, int16_t y)
{
return ((int32_t)x) * y;
}


(source : http://www.embeddedrelated.com/groups/msp430/show/48311.php but replacing short and long by int16_t and int32_t )


Secondly, I have to replace the log function by logf :
Ratio = (unsigned int) (100.0*logf(y)/logf(x));



And finally I have to add -lm at the end of the command line of compilation :
msp430-gcc -Os -mmcu=msp430fg439 MOD-PULSE.c -o MOD-PULSE.out -lm

I hope it could help someone.

Best regards,

Antoine