audiocommander Posted January 3, 2007 Report Share Posted January 3, 2007 Hello everyone,The information about this issue is a bit cluttered, so I start a new thread about it.My aim and the reason for this posting is: I want to achive full *nix compatibility and be able to change and compile ASM based applications (like the SpeakJet PIC16F Firmware) without windows.As you might know, one cannot compile MIOS sourcecodes (and also ASM based applications) with GPASM. Only MPASM can do the job without errors, but the cause of this is quite simple: The problem is an instruction parameter passing in the Macros defined in "macros.h"http://www.midibox.org/forum/index.php?topic=8175.msg57319#msg57319As this bash script using sed is obviously not working on macs (don't know the reason though, seems I'm too dumb to read regular Expressions...), I wrote a perl script, that you can download here:http://www.audiocommander.de/downloads/midibox/mpasm2gpasm.tgz (4kb)It's my first perl script ever, so don't expect poetry and elegance...The thing is however:- I tested it with the bootloader src and it works fine, can compile it & the hex is the same the original hex-file.- I haven't tested it with the MIOS src, because I don't know how to setup a linker script to generate a Makefile for gputilsAs some of you might have read in the speakJet thread, I have massive problems to compile the SJ firmware for the PIC16F. The generated .hex-file is different from .hex files compiled on Win-PCs. So I guess this is another incompatibility issue between MPLAB and GPUtils.Because I checked the bootloader .hex and it is not different from the original bootloader .hex, I can roule out gpasm as the error... so the linker comes to my view.I'm going to interspect that and report back, if someone likes to try the perl-script or has a nice link for me about GPUtils and Linkers, I'd be happy for feedbacks...Cheers,MichaelRelated Links:Wiki: How to compile MIOS on linux:http://www.midibox.org/dokuwiki/doku.php?id=compiling_the_midibox_source_on_linuxCompile on Linux please:http://www.midibox.org/forum/index.php?topic=6420.0Assembler SID Help:http://www.midibox.org/forum/index.php?topic=8175.30Speakjet (hex file mismatch, unresolved):http://www.midibox.org/forum/index.php?topic=2870.msg54723#msg54723 Quote Link to comment Share on other sites More sharing options...
stryd_one Posted January 4, 2007 Report Share Posted January 4, 2007 Man I wish I could help, but I'm a total *nix idiot... Just wanted to give props, cause I don't intend upon being stuck on windoze forever. Quote Link to comment Share on other sites More sharing options...
audiocommander Posted January 4, 2007 Author Report Share Posted January 4, 2007 Hey stryd, your feedback is very welcome :)What I need is no *nix guru, but some experienced know-how about ASM, Linker-Scripts and Makefiles. I remember your PIC18F620 tutorials and the talks about >256 byte arrays that require linker-adaptions... you know, when I'm looking at the linker script, my eyes pop out and all I see is numbers . And up to now, all readings I've done could not light up my personal brain darkness in this area ;DUp to now I tried <updated>:PIC18F-based apps:- bootloader: okay*- midimon_v2_0: okay*- mios_v1_9c_src: okay*- midibox_fm_v1_1: okay* (some warnings may occur)PIC16F-based apps:- midimerger_v1.4: not okay*- mbhp_iic_speakjet_v1_0: not okay**- mbhp_iic_midi_v1_0: not okay*** macro conversion with perl-script** no macro conversion neededI'm not yet totally clueless, but shortly before :)see my last experiment with the mbhp_iic_midi below; I just generated the makefile with mkmk.pl and compiled the unaltered sources without errormessages with gpasm... the result is attached...Cheers,MichaelEdit: added test results for ASM based midimon & midimerger apps.The good thing however is, that my perl-script seems to work sofar 8)Edit2: added FM, changed MIOS_v1_9c results, split into PIC16 & 18 results... gets a lot clearer now... Quote Link to comment Share on other sites More sharing options...
TK. Posted January 7, 2007 Report Share Posted January 7, 2007 Nice work! :)I gave the MBFM source code a try; some gpasm errors are related to the reason, that the converter doesn't ignore comments. E.g., if a comment contains "IFSET", a new line will be generated with a propably wrong (or unwanted) instruction.When you replace: # search for macro occurences if( $_ =~ m/$macros[$m]/ ) {[/code] by: [code] # search for macro occurences if( $_ =~ /^\s+$macros[$m]/ ) { it will work better, as only valid macros will be replaced. Thereafter we have only a few number of errors: cs_menu_print.inc:714:Error [103] syntax errorcs_menu_print.inc:715:Error [174] Unknown opcode "print"cs_menu_print.inc:738:Error [103] syntax errorcs_menu_print.inc:739:Error [174] Unknown opcode "print"[/code] appr. replaced code: [code] btfss TMP1, 6, movlw '-'; (if value <= 0x3f (6th bit cleared) print "-" means: we still have a problem with comments. A quick&dirty solution: # search for macro occurences if( $_ =~ /^\s+$macros[$m]/ ) { s/;.*//g; # remove comments[/code] There is still one error thereafter: [code]cs_menu_io_tables.inc:75:Error [108] Illegal Character (,)but this is a syntax error from my side which was ignored by MPASM - remove the "," at the end of the line.Code can be assembled with "gpasm main.asm", there is no linker script required, w/o the "-c" option you will get a .hex file (main.hex) by defaultBest Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
audiocommander Posted January 7, 2007 Author Report Share Posted January 7, 2007 cool, thanks a lot for the suggestions!I updated the pl script.There were some more warnings when I tried with the FM source, but at least a hex file was generated... :)And I detected two more errors (in the script) while converting MIOS v1_9c, but I'll look into that as soon as I have some more time, and maybe I'll implement some error checking methods. When the script runs fine, I'll put it to the Wiki.There's also some more good news regarding the differing hex files:My testings revealed that – as far as I can say until now – only sources written for the PIC16F are wrong.It seems all sources for PIC18F's can be compiled well with gpasm!:)Best regards,Michael Quote Link to comment Share on other sites More sharing options...
chriss Posted January 7, 2007 Report Share Posted January 7, 2007 hello,first i want to say that i am happy that you work on a solution for linux, mac users.but in my case it does not work...here my result in the terminal, maybe it helps. Application is the MbSEQ V3 build 60cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:418:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:418:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:418:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:418:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:418:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:418:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:418:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:418:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_m_morph.inc:47:Message [305] Using default destination of 1 (file).cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:418:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:418:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.seq_enc.inc:102:Error [113] Symbol not previously defined (SEQ_ENC_Handler_MenuPageCS_NoNewPos).seq_enc.inc:102:Error [126] Argument out of range (-16495 not between -128 and 127)seq_layer.inc:139:Warning [202] Argument out of range. Least significant bits used.seq_layer.inc:154:Warning [202] Argument out of range. Least significant bits used.seq_chord.inc:14:Warning [202] Argument out of range. Least significant bits used.seq_chord.inc:14:Warning [202] Argument out of range. Least significant bits used.seq_chord.inc:14:Warning [202] Argument out of range. Least significant bits used.seq_chord.inc:14:Warning [202] Argument out of range. Least significant bits used.seq_chord.inc:14:Warning [202] Argument out of range. Least significant bits used.seq_chord.inc:14:Warning [202] Argument out of range. Least significant bits used.seq_chord.inc:14:Warning [202] Argument out of range. Least significant bits used.seq_chord.inc:14:Warning [202] Argument out of range. Least significant bits used.seq_chord.inc:14:Warning [202] Argument out of range. Least significant bits used.seq_chord.inc:14:Warning [202] Argument out of range. Least significant bits used.seq_chord.inc:14:Warning [202] Argument out of range. Least significant bits used.seq_chord.inc:14:Warning [202] Argument out of range. Least significant bits used.seq_chord.inc:14:Warning [202] Argument out of range. Least significant bits used.seq_chord.inc:14:Warning [202] Argument out of range. Least significant bits used.seq_chord.inc:14:Warning [202] Argument out of range. Least significant bits used.seq_chord.inc:14:Warning [202] Argument out of range. Least significant bits used.seq_chord.inc:14:Warning [202] Argument out of range. Least significant bits used.seq_chord.inc:14:Warning [202] Argument out of range. Least significant bits used.seq_core.inc:1715:Message [305] Using default destination of 1 (file).unfortunatly i am not able to read this, so i show it to you. And there is no hex file generated. Is the fault in my setup?i can send you the text after the mpasm2gpasm.pl as well..as far as i can say everthing seems to work..thanks again for the good workchriss Quote Link to comment Share on other sites More sharing options...
audiocommander Posted January 7, 2007 Author Report Share Posted January 7, 2007 hi chriss,it's not so hard to read this :)it's like this:[tt]filename:line:level{warning,message,error} [error-id] explanation[/tt]cs_menu.inc:417:Warning [202] Argument out of range. Least significant bits used.416: CS_MENU_PARAMETER_ENTRY MACRO value, max, cursor, width, hook 417: db value, max 418: db cursor, width 419: dw hook 420: ENDM Hm, maybe we got a new keyword here?I'd think that [tt]dw hook[/tt] is a goto-like instruction? Then it would be the same "errortype" like IFSET, BIFSET and so on...However, I bet it's the reason for this error, that actually keeps the hex file from being generated:seq_enc.inc:103:Error [113] Symbol not previously defined (SEQ_ENC_Handler_MenuPageCS_NoNewPos)I must look this up before I can say anything valueable; but I must admit my time is currently very limited. If you're patient, you could wait some days/weeks until I come around to make some checkings, if you need it at once, you could try to "resolve" this macro manually. It seems it's not occurring too often...At least it seems to be just one error and the script solved 853 occurences 8) :DBest regards,Michael Quote Link to comment Share on other sites More sharing options...
chriss Posted January 29, 2007 Report Share Posted January 29, 2007 thanks audiocommander for the Help,in the meantime i found the time to test it with the FM 1.1 and that works, besides the warnings, i couldn´t test it with a real MB Core though, but i generated a hex file.so longchristoph Quote Link to comment Share on other sites More sharing options...
stryd_one Posted May 16, 2007 Report Share Posted May 16, 2007 *bump* ;)Hey guys is anyone here (aside from TK who is too busy for such trivial things) good at perl? Maybe you've had some more practice since this first script you wrote AC?I'd really like to make a full macro conversion script out of this, as it makes it easier to include existing ASM code in our C projects. It's just a glorified search&replace thing really, and I can explain what needs to be done, if you can cut the code.I've just done this manually, so that the nokia driver can be included in a C app, but It would be very nice to have an automated method, as it will make it much faster, and also means that we can use gpasm all the time, which gives us a nice multi-platform solution for compiling anything midibox :)I hope someone can volunteer their time :) Thanks! Quote Link to comment Share on other sites More sharing options...
audiocommander Posted May 22, 2007 Author Report Share Posted May 22, 2007 i'd be willing to help, but it's all a bit stressful atm :-\also: I'm not really a perl hacker in the meanwhile...But I think everything's good that helps making mbhp platform independent...cheers,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.