Recent

Author Topic: PicPas, Pascal compiler for Microchip PIC  (Read 115082 times)

Edson

  • Hero Member
  • *****
  • Posts: 1301
Re: PicPas, Pascal compiler for Microchip PIC
« Reply #45 on: June 02, 2017, 12:50:04 am »
... and here comes a translation-patch


Good.  :) I'm preparing the next version now. I will be including the patch.
 
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: PicPas, Pascal compiler for Microchip PIC
« Reply #46 on: June 02, 2017, 01:36:47 am »
The control structs are now implemented at the style of Modula-2
This is my preference too ::), also found in AvrCo Pascal. Code is easier to look at.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

Edson

  • Hero Member
  • *****
  • Posts: 1301
Re: PicPas, Pascal compiler for Microchip PIC
« Reply #47 on: June 02, 2017, 04:18:50 pm »
This is my preference too ::), also found in AvrCo Pascal. Code is easier to look at.
Yes. Althought AvrCon have the delimiters "ENDWHILE", "ENDCASE", "ENDFOR". It seems me more to Visual Basic syntax, but anyway it's good.

By the way, I was triying to use the PicCo 32, but no success. I compile, but nothing appears, just a beep. It's a very old program, very simple editor and interfaz.

PicPas has a compatibility mode. If you include {$MODE PASCAL}, then PicPas will recognize the old classic syntax of Pascal, for control structs, like:
IF ... THEN
  BEGIN
  END 
ELSE
  BEGIN
  END;

Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: PicPas, Pascal compiler for Microchip PIC
« Reply #48 on: June 02, 2017, 07:36:20 pm »
By the way, I was triying to use the PicCo 32, but no success. I compile, but nothing appears, just a beep. It's a very old program, very simple editor and interfaz.
Well, PicCo used to work 20 years ago before it was abandoned in favor of AvrCo  :-[. AvrCo is much improved (although editor could be better), and the best thing is it's simulator and visual JTAG/PDI debugger. You can set hardware absolute and conditional breakpoints, exec step by step, or browse locals and watches. Sim can even show graphical, line lcd or 7/14seg, and lots of other drivers. It's worth a look.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

mischi

  • Full Member
  • ***
  • Posts: 170
Re: PicPas, Pascal compiler for Microchip PIC
« Reply #49 on: June 03, 2017, 04:29:38 pm »
Dear Edson

Out off curiosity, I had a brief go on macOS. My brief report:

The first barrier was the usage of all your other units. I simply proceeded by missing error message, downloading and compiling. Although i created an app bundle, starting the app through double click or from within Lazarus did not work smoothly, probably because of error messages, but i am not sure. Therefore, I started the app with the open command from the command line, and i got some warnings and errors, all related to paths. The three folders samples, temp, and units were created in the application bundle (PicPas-darwin.app → Contents → MacOS). This might still work, but could be probably be improved. Depending on the usage, the should be placed somewhere else. Next came an error message, that the file PicPas_AsmPic.xml could not be loaded. I tried to put the file at a number of places, but none worked. This is probably the related line Source/FormPrincipal.pas:  hlAssem.LoadFromFile('PicPas_AsmPic.xml');
I do not really know, what the default path of LoadFromFile is and how it could be set.

I got stuck and stopped at this point, but maybe some else can jump in and help.

Michael.

Update: macOS 10.12.5, lazarus 1.6.4, fpc 3.0.2 (from fink), i386-carbon-lcl.
« Last Edit: June 03, 2017, 04:33:23 pm by mischi »

Edson

  • Hero Member
  • *****
  • Posts: 1301
Re: PicPas, Pascal compiler for Microchip PIC
« Reply #50 on: June 03, 2017, 05:43:23 pm »
The three folders samples, temp, and units were created in the application bundle (PicPas-darwin.app → Contents → MacOS). This might still work, but could be probably be improved. Depending on the usage, the should be placed somewhere else. Next came an error message, that the file PicPas_AsmPic.xml could not be loaded. I tried to put the file at a number of places, but none worked. This is probably the related line Source/FormPrincipal.pas:  hlAssem.LoadFromFile('PicPas_AsmPic.xml');
I do not really know, what the default path of LoadFromFile is and how it could be set.

Thanks @mischi for testing.
Sadly my experience in Mac is NULL, and I don't have where to test.
PicPas require some folders to work. '/samples', '/units' and '/temp'. The two first exist in GitHub, so they are included in the ZIP or repository. Anyway, they have not critical files, and if PicPas doesn't found them, will create them (or try). The folder /temp, wil be created by PicPas. I will include /temp in GitHub too, in next versions.

Yes, the file PicPas_AsmPic.xml, is loaded en TfrmPrincipal.FormCreate(), and it's the highlighter for the ASM visor. It's supposed to be in the same path of the program, that's why it has no information of path. I don't know how it works on Mac, but in Windows/Linux it works right.


Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

jc99

  • Hero Member
  • *****
  • Posts: 553
    • My private Site
Re: PicPas, Pascal compiler for Microchip PIC
« Reply #51 on: June 04, 2017, 09:33:10 am »
My solution for those problems is a config-unit that handles configuration-issues (platform depended) and also emits a DataPath to a Directory the user/program has read/write access on.
on Windows-PC it's also not advisable to put Data-Files around the binary. They should be in %APPDATA%\<Vendor>\<AppName>\ ... on unix it's normaly ~/.<appname>/ i think this also counts for Mac.
Common data in Windows should be in %ProgramData%\<Vendor>\<AppName>\

All files have the prefix DataPath+DirectorySeparator+
e.G: for 'Test.dat' it looks like
Code: [Select]
...LoadFromFile(DataPath+DirectorySeparator+'Test.dat');
« Last Edit: June 04, 2017, 09:38:28 am by jc99 »
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.4 - 1.8.4, 2.0
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are
If you want to do something for the environment: Twitter: #reduceCO2 or
https://www.betterplace.me/klimawandel-stoppen-co-ueber-preis-reduzieren

mischi

  • Full Member
  • ***
  • Posts: 170
Re: PicPas, Pascal compiler for Microchip PIC
« Reply #52 on: June 04, 2017, 02:52:54 pm »
The linux solution with ~/.<appname> is also possible on macOS, but not really according to the guidelines. The best place for files, which should be exchanged on an update of the program is in the application bundle. Examples are general resources of the program like icons, sounds, texts and so on. Files, which should "survive" an update should better go to ~/Library/Application Support/<appname>. Special alternatives to this are ~/Library/Logs, ~/Library/Caches, ~/Library/Preferences and maybe more. However, taking the guide lines strictly, one should not even use these paths literally, but use the corresponding calls of the system API, (for example the functions CFPreferences* or NSDefaults) although i never went that far.

I'll have a look, whether i can at least manage to load PicPas_AsmPic.xml.

Edson

  • Hero Member
  • *****
  • Posts: 1301
Re: PicPas, Pascal compiler for Microchip PIC
« Reply #53 on: June 04, 2017, 06:05:15 pm »
I prefer to have all the files in a single path, in order to have a simple portable app. But if this can have problems in Mac, it can be changed using {$IFDEF DARWIN} or something like this. You can make a Pull request in the GitHub, or send me the code to change.   :)
« Last Edit: June 04, 2017, 06:08:19 pm by Edson »
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

Edson

  • Hero Member
  • *****
  • Posts: 1301
Re: PicPas, Pascal compiler for Microchip PIC
« Reply #54 on: June 04, 2017, 06:30:06 pm »
PicPas is updated to the version 0.6.7.  :D  https://github.com/t-edson/PicPas

Blocks ASM, now includes complete support for labels on instructions GOTO and CALL, and access for WORD variables.
Internal "Type Helpers" are added to the types Byte and Word:

Code: Pascal  [Select][+][-]
  1.  
  2.   byte_var.bit0 := 1;
  3.   word_var.Low.bit7 := 0;
  4.  

Thanks to @jc99, now a German translation is included. There are new terms to translate. Translation files are in path: /languages

« Last Edit: June 04, 2017, 06:32:15 pm by Edson »
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

majid.ebru

  • Sr. Member
  • ****
  • Posts: 494
Re: PicPas, Pascal compiler for Microchip PIC
« Reply #55 on: June 04, 2017, 08:23:19 pm »
Very Goooooood ;D ;D

mischi

  • Full Member
  • ***
  • Posts: 170
Re: PicPas, Pascal compiler for Microchip PIC
« Reply #56 on: June 04, 2017, 10:57:32 pm »
Update for macOS: A s a quick fix specifying absolute paths to files helps.

In addition, there is still an access error. Config is not assigned, when used in the procedure TfraSyntaxTree.ComboBoxEx1Change in file FrameSyntaxTree.pas. I do not really know, how to fix this. I tried to call Config.Inciar, but that failed.

A range check error in FameMessagesWin.pas: timeCnT should be QWord and not Dword.
Changing line 42 to

timeCnt: QWORD;

fixes the range check error.

I just saw, that both issues are fixed in 0.6.7.

MiSchi
« Last Edit: June 04, 2017, 11:58:53 pm by mischi »

Edson

  • Hero Member
  • *****
  • Posts: 1301
Re: PicPas, Pascal compiler for Microchip PIC
« Reply #57 on: June 04, 2017, 11:35:25 pm »
Update for macOS: A s a quick fix specifying absolute paths to files helps.

Do you refer to:  hlAssem.LoadFromFile('PicPas_AsmPic.xml');  in FormPrincipal unit? I can specify the full AppPath if it helps.

In addition, there is still an access error. Config is not assigned, when used in the procedure TfraSyntaxTree.ComboBoxEx1Change in file FrameSyntaxTree.pas. I do not really know, how to fix this. I tried to call Config.Inciar, but that failed.

Can you show the stack of calls? It's not supposed to call TfraSyntaxTree.ComboBoxEx1Change() before Config is assigned. Anyway I can add:
Code: Pascal  [Select][+][-]
  1. if Config<>nil then ...
to protect.

A range check error in FameMessagesWin.pas: timeCnT should be QWord and not Dword.
Changing line 42 to

timeCnt: QWORD;

fixes the range check error.

Changed in the GitHub.
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

Edson

  • Hero Member
  • *****
  • Posts: 1301
Re: PicPas, Pascal compiler for Microchip PIC
« Reply #58 on: June 07, 2017, 09:53:15 pm »
PicPas 0.6.8 released.   :)
Improved the IDE, and the assembler output to be compatible with MPLab.
New options added to the Config Form. Word operations revised, and included the directive ORG in assembler blocks.
FAIK, PicPas have now, the best assembler support of all the PIC Compilers I have seen.
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

jc99

  • Hero Member
  • *****
  • Posts: 553
    • My private Site
Re: PicPas, Pascal compiler for Microchip PIC
« Reply #59 on: June 08, 2017, 02:26:22 am »
Next patch ...
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.4 - 1.8.4, 2.0
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are
If you want to do something for the environment: Twitter: #reduceCO2 or
https://www.betterplace.me/klimawandel-stoppen-co-ueber-preis-reduzieren

 

TinyPortal © 2005-2018