istephen Posted August 10, 2005 Report Share Posted August 10, 2005 Hi,I'm just starting writing a bit of code for my midiBox (currently under construction).I'm working in MacOSX, so converted the batch files to a makefile which seems to work well. I've attatched the makefile I used to compile the analog-toolkit. To compile others, just check the defines at the top match those in make.bat, and set OBJS to match the file list (adding .o on the end). You don't need to include mios_wrapper, or pic18*.o, as the makefile adds them in automatically.You may need to use gmake, rather than make if you're running this on other platforms.When I compiled a few things the hex files were SLIGHTLY different to those included in the package. This may be due to a different build of the compiler/assembler, or maybe just some config options. I haven't been able to test any compiled apps, as my hardware is still not ready.hope others find this helpfull.Ianp.s. watch out for the tabs - that have become spaces in the html version. If you copy/paste this you'll need to turn any spaces at the start of lines into tabs, otherwise it won't work. PROJECT=project MIOS_WRAPPER_DEFINES=-DSTACK_HEAD=0x37f -DSTACK_IRQ_HEAD=0x33f SDCC_DEFINES=-DDEBUG_MODE=0 OBJS=main.o aout.o midi.o lfo.o eg.o map.o # === general settings ====================================================== CC=sdcc CFLAGS=-S -mpic16 -p18F452 --fstack --fommit-frame-pointer --optimize-goto --optimize-cmp --disable-warning 85 --obanksel=2 -pleave-reset-vector ${SDCC_DEFINES} FIXASM=perl tools/fixasm.pl GPASM=gpasm -c ${PROJECT}.syx:${PROJECT}.hex perl tools/hex2syx.pl ${PROJECT}.hex ${PROJECT}.hex : ${OBJS} pic18f452.o mios_wrapper.o gplink -s ${PROJECT}.lkr -m -o ${PROJECT}.hex mios_wrapper.o pic18f452.o ${OBJS} #=== assemble MIOS SDCC wrapper and device specific setup ================== mios_wrapper.o : mios_wrapper/mios_wrapper.asm ${GPASM} ${MIOS_WRAPPER_DEFINES} -I mios_wrapper mios_wrapper/mios_wrapper.asm -o mios_wrapper.o %.o : %.c %.asm : %.c ${CC} ${CFLAGS} $< -o $@ ${FIXASM} $@ %.o : %.asm ${GPASM} $< -o $@ clean : rm -rf *.o *.asm *.lst ${PROJECT}.cod ${PROJECT}.hex ${PROJECT}.syx ${PROJECT}.map Quote Link to comment Share on other sites More sharing options...
pilo Posted August 10, 2005 Report Share Posted August 10, 2005 Excellent :)I made a tiny a quick makefile before, but only to compile single .c file project .I change for yours npw ;)Thank you! Quote Link to comment Share on other sites More sharing options...
TK. Posted August 13, 2005 Report Share Posted August 13, 2005 Thanks for the input!Due to the crappy support of Makefiles in a windows environment (e.g. GNU make cannot reference external commands without absolute path), I will propably write a makefile generator which generates a simpler make.bat as the one currently used (because it doesn't work under Win98 and WinME), and a Makefile for Unix/MacBest Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
logo64 Posted August 15, 2005 Report Share Posted August 15, 2005 Thanks for the input!Due to the crappy support of Makefiles in a windows environment (e.g. GNU make cannot reference external commands without absolute path), I will propably write a makefile generator which generates a simpler make.bat as the one currently used (because it doesn't work under Win98 and WinME), and a Makefile for Unix/MacI have spent about 4 hours trying to get the makefile to work in WinME... and the best I could do, was to find workaround for the problem with having a string defined with an = character in it. Just split the string in two or three, around the offensive = symbol, and when you execute the strings later on, add the = symbol.For example, [tt]set MIOS_WRAPPER_DEFINES=-DSTACK_HEADset MIOS2=0x37f -DSTACK_IRQ_HEADset MIOS3=0x33f%GPASM% %MIOS_WRAPPER_DEFINES%=%MIOS2%=%MIOS3%[/tt]Crude, but this works.Now my problems seem to have become much worse - my system hangs when I run the make.bat file. Haven't had much time to fight this... would rather solder boards really.-gerald Quote Link to comment Share on other sites More sharing options...
TK. Posted August 15, 2005 Report Share Posted August 15, 2005 I've implemented the makefile generator, which should help to make the build process compatible to Unix and all Windows versions.It's now part of following packages:http://www.ucapps.de/mios/sdcc_skeleton_v1_0b.ziphttp://www.ucapps.de/mios/midibox_mm_v2_0b.ziphttp://www.ucapps.de/mios/analog_toolbox_v1_1b.zipIan/Pilo: could you please test the Makefile under Mac/Linux?Gerald: could you please check it with your windows version?Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
TK. Posted August 15, 2005 Report Share Posted August 15, 2005 due to a copy error I released the wrong version of mkmk.pl - it's corrected in the *b.zip release (links above are modified)Note also that the C wrapper contains a bugfix for the MIOS_TIMER_Init() and _Reinit() function - don't use the old wrapper anymoreBest Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
logo64 Posted August 21, 2005 Report Share Posted August 21, 2005 I've implemented the makefile generator, which should help to make the build process compatible to Unix and all Windows versions.Gerald: could you please check it with your windows version?I tried it - but something terrible is happening, I believe with SDCC - I keep getting general protection faults, and other errors that crash my computer HARD. I was getting these errors with the previous version of the makefile.bat, and I suspect it is something about windoze ME. I'd love to keep fighting with this, but I worry about corrupting my hard-disk with so many hard-boots. Maybe I should make a DOS boot disk, and try to run it without windows in the background?-gerald Quote Link to comment Share on other sites More sharing options...
moebius Posted August 21, 2005 Report Share Posted August 21, 2005 Uh,With a such rock solid filesystem as WinME has, I wouldn't worry so much about harddisk corruption.. You know, my 98SE only loses the data it's writing to disk when the crash comes. ;DBye, Moebius Quote Link to comment Share on other sites More sharing options...
pilo Posted August 22, 2005 Report Share Posted August 22, 2005 it seems to work well under linuxonly trouble with gpasm, I had to comment line 37 of p18f452.inc MESSG "Processor-header file mismatch. Verify selected processor."thanks TK ;) Quote Link to comment Share on other sites More sharing options...
istephen Posted August 22, 2005 Author Report Share Posted August 22, 2005 Finally got round to testing the new versions, and they seem to work great on MacOSX 10.3.9.thanksIan Quote Link to comment Share on other sites More sharing options...
audiocommander Posted December 30, 2005 Report Share Posted December 30, 2005 hum ... maybe there's a huge lack of very important information inside my head, but I couldn't do anything with this "OS X"-Makefile. So I converted the existing makefile.bat from the 1.0.c skeleton into a bash-script for os x: #! /bin/bash # MAKEFILE FOR BASH # ASSEMBLING / LINKING SDCC / GPASM / PIC # FOR MIDIBOX ->> www.ucapps.de <<- # setting up main vars PROJECT='project'; # assembling echo '*** BUILDING & LINKING' $PROJECT '************************************************'; echo 'Setting up _output directory...' mkdir _output; echo 'Assembling MIOS SDCC wrapper...' gpasm -c -DSTACK_HEAD=0x37f -DSTACK_IRQ_HEAD=0x33f -I mios_wrapper mios_wrapper/mios_wrapper.asm -o _output/mios_wrapper.o # building echo 'Building the project files...' echo 'Compiling pic18f452.c' sdcc -S -mpic16 -p18F452 --fstack --fommit-frame-pointer --optimize-goto --optimize-cmp --disable-warning 85 --obanksel=2 -pleave-reset-vector -DDEBUG_MODE=0 pic18f452.c -o _output/pic18f452.asm ./tools/fixasm.pl _output/pic18f452.asm gpasm -c _output/pic18f452.asm -o _output/pic18f452.o # compiling echo 'Compiling main.c' sdcc -S -mpic16 -p18F452 --fstack --fommit-frame-pointer --optimize-goto --optimize-cmp --disable-warning 85 --obanksel=2 -pleave-reset-vector -DDEBUG_MODE=0 main.c -o _output/main.asm ./tools/fixasm.pl _output/main.asm gpasm -c _output/main.asm -o _output/main.o # linking echo 'Linking '$PROJECT gplink -s project.lkr -m -o $PROJECT.hex _output/*.o # converting echo 'Converting '$PROJECT'.syx to '$PROJECT'.hex' ./tools/hex2syx.pl $PROJECT.hex # done! echo 'Done! ------------------------------------------------------------------------'; here is the same post along with some more instructionsI hope this is to some use for someone.If this isn't the 'right' way, please feel free to correct things, at least this is simply working without the need of having VPC and PC-Stuff installed...regards,Michael Quote Link to comment Share on other sites More sharing options...
TK. Posted December 31, 2005 Report Share Posted December 31, 2005 Hi Michael,thanks for your contribution, good to hear that it works in principle with the Mac.Well, the problem with your static make.sh script is, that it won't be automatically enhanced if additional source files are added to the project. Thats the reason, why I've implemented a makefile generator, which generates a "Makefile" for Unix, and a "make.bat" for DOS.-> see tools/mkmk.pl and "MAKEFILE.SPEC"I would propose to get use of this generator in order to guarantee the compatibility with complex C application (it would also be more newbie-friendly)There are two ways: either the mkmk.pl script generates a make.sh file for MacOSX, or we are trying to improve the generated Makefile, so that it runs under Linux and MacOSXDid you try out the Makefile? "make -f Makefile" should also work on the Mac, no?Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
audiocommander Posted December 31, 2005 Report Share Posted December 31, 2005 Hi Thorsten,"make -f Makefile"The *nix makefile must have slipped away before my eyes ???I just tried calling "Make" in the test-directory and it worked.Dunno, maybe the root of all evil was that I had the SDCC 2.4 for mac -"edition" which did not compile properly... ...and now I got 2.5.4 installed (had no success with 2.5.0)Nevertheless, I learned a lot about makefiles ::)Thanks & regards,Michael Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.