Ambika building code help

Hi,

I’m trying to get an environment setup so that I can compile Ambika code. First question: if I have an environment setup where I can repeatably and successfully compile Shruthi code, will that same environment work for Ambika code? I’m trying to use the same WinAVR-20100110 that works for me in Windows with Shruthi code.

This is an error that I’m getting when trying to compile the voicecard code:

C:\ambika-master\voicecard>make -f makefile
mkdir -p build/ambika_voicecard/
cat build/ambika_voicecard/adc.d build/ambika_voicecard/random.d build/ambika_vo
icecard/serial.d build/ambika_voicecard/string.d build/ambika_voicecard/time.d b
uild/ambika_voicecard/wii_nunchuk.d > build/ambika_voicecard/depends.mk
mkdir -p build/ambika_voicecard/
cat build/ambika_voicecard/adc.d build/ambika_voicecard/random.d build/ambika_vo
icecard/serial.d build/ambika_voicecard/string.d build/ambika_voicecard/time.d b
uild/ambika_voicecard/wii_nunchuk.d > build/ambika_voicecard/depends.mk
mkdir -p build/ambika_voicecard/
cat build/ambika_voicecard/adc.d build/ambika_voicecard/random.d build/ambika_vo
icecard/serial.d build/ambika_voicecard/string.d build/ambika_voicecard/time.d b
uild/ambika_voicecard/wii_nunchuk.d > build/ambika_voicecard/depends.mk
c:\WinAVR-20100110\bin/avr-gcc -mmcu=atmega328p -lm -Os -Wl,–gc-sections -o bui
ld/ambika_voicecard/ambika_voicecard.elf build/ambika_voicecard/adc.o build/ambi
ka_voicecard/random.o build/ambika_voicecard/serial.o build/ambika_voicecard/str
ing.o build/ambika_voicecard/time.o build/ambika_voicecard/wii_nunchuk.o -lc
c:/winavr-20100110/bin/…/lib/gcc/avr/4.3.3/…/…/…/…/avr/lib/avr5/crtm328p.o:
(.init9+0x0): undefined reference to `main’
make: *** [build/ambika_voicecard/ambika_voicecard.elf] Error 1

So it is building some of the .d and .o files and then it stops with this error. Do I need different stuff / different resources / different gcc stuff to build the Ambika code?

Thanks,
Robert

I got some creative help from a friend, I came up with this solution on Windows and got both objects to compile.

How to compile Ambika code

On Win10 x64, donwload latest WinAVR from SourceForge, followed the hints here:
(http://www.chibios.com/forum/viewtopic.php?p=16023) to install a new msys dll
in the same directory as sh.exe, and change the path to tools in avrlib\makefile.mk.

Create the file main.cc, put this stuff in here:

extern int cc_main(int argc, char *argv[]); // The main in voicecard.cc

extern “C” // in a C++ file, this makes the things inside plain C
{
/* This main() is plain C, and will call the c++ main in VoiceCard.cc */
int main(int argc, char *argv[]) { return cc_main(argc, argv); }
}

Add this main.cc to the project files, to both controller and voicecard code directories.
Change the main() function in voicecard.cc and controller.cc to int cc_main(int argc, char *argv[])

Create the make directories first:
C:\ambika-master\build\ambika_controller
C:\ambika-master\build\ambika_voicecard

Call these to build the code:
c:\ambika-master>make -f controller/makefile
c:\ambika-master>make -f voicecard/makefile

tada!