Linux Port :)

You have successfully tested a non-tested PIC model, programmer interface, created a new devices.ini paragraph, performed a new translation, don't hesitate to publish that information here.

Re: Good project :)

Postby admin » 06, 2010 Jun Sun 10:43 pm

If you find a way to control each pins of serial port or parallel port independently with Linux libraries, it will be easy to port.
For serial port you just have to substitute the calls to EscapeCommFunction, GetCommModemStatus (initialisation with CreateFile/CloseHandle)
For Parallel port: WriteIoPortByte, ReadIoPortByte (initialization with InitOpenLibSys, DeinitOpenLibSys)
Of course the handles for the those methods must be adapted to the interface.

Philippe
admin
Site Admin
 
Posts: 153
Joined: 12, 2009 Jul Sun 7:20 pm

Re: Good project :)

Postby Death Knight » 07, 2010 Jun Mon 10:27 am

I could look parallel port later since I don't have parallel port programmer but serial one.
For controlling parallel port easily, we could use parapin too.

I think job is not easy as you think.
pic_hw.cpp has some problems with linux because of windows depended variables and definitions.

Code: Select all
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:71: error: 'HMODULE' does not name a type
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:86: error: 'HMODULE' does not name a type
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:135: error: 'HANDLE' does not name a type
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:136: error: 'DCB' does not name a type
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:137: error: 'OVERLAPPED' does not name a type
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:141: error: 'LONGLONG' does not name a type
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp: In function 'bool COM_OpenPicPort()':
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:152: error: 'DCB' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:152: error: expected `;' before 'MyDCB'
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:153: error: 'COMMTIMEOUTS' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:153: error: expected `;' before 'MyCommTimeouts'
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:155: error: 'COM_hComPort' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:155: error: 'INVALID_HANDLE_VALUE' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:201: error: 'COM_hComPort' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:201: error: 'INVALID_HANDLE_VALUE' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:224: error: 'COM_sOverlappedIo' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:224: error: 'OVERLAPPED' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:225: error: '::CreateEvent' has not been declared
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:229: error: 'GENERIC_READ' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:229: error: 'GENERIC_WRITE' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:232: error: 'OPEN_EXISTING' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:233: error: 'FILE_FLAG_OVERLAPPED' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:234: error: 'CreateFile' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:245: error: 'MyDCB' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:246: error: 'GetCommState' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:249: error: 'CloseHandle' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:282: error: 'DTR_CONTROL_ENABLE' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:289: error: 'RTS_CONTROL_ENABLE' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:307: error: 'SetCommState' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:310: error: 'CloseHandle' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:317: error: 'MyCommTimeouts' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:360: error: 'SetCommTimeouts' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:363: error: 'CloseHandle' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp: In function 'bool COM_ClosePicPort()':
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:383: error: 'DCB' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:383: error: expected `;' before 'dcb'
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:385: error: 'COM_sOverlappedIo' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:386: error: 'CloseHandle' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:390: error: 'COM_hComPort' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:390: error: 'INVALID_HANDLE_VALUE' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:392: error: 'dcb' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:393: error: 'GetCommState' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:394: error: 'DTR_CONTROL_DISABLE' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:395: error: 'RTS_CONTROL_DISABLE' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:396: error: 'SetCommState' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:397: error: 'CloseHandle' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp: In function 'uint16_t COM_GetPicDataBit()':
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:424: error: 'COM_hComPort' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:424: error: 'INVALID_HANDLE_VALUE' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:429: error: 'DWORD' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:429: error: expected `;' before 'dwModemStatus'
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:430: error: 'dwModemStatus' was not declared in this scope
/home/compile/svn/wxpic/Branches/posix-porting/src/WinPic/WinPicPr/pic_hw.cpp:430: error: 'GetCommModemStatus' was not declared in this scope


Do you sure if its enough to put EscapeCommFunction, GetCommModemStatus functions to pic_hw for serial port access now?
Death Knight
 
Posts: 53
Joined: 30, 2010 May Sun 10:18 pm

Re: Good project :)

Postby admin » 07, 2010 Jun Mon 5:32 pm

Of course as I mentioned you have also to adapt the handle for the port. Usually the interface allows you to request an access to the port and returns a handle for managing this access. In Linux this may be a file descriptor. The "most complicated" could be if the parallel port access does not give you a direct access to the Parallel registers. At this moment Winpic writes the image of those registers in 2 fields. One represents the state of pins D0 to D7 the other the state of the control pins. If the Linux interface does not access the control pin as a single word but as independent commands, a little adaptation will be necessary. I can't imagine that the data bus is not controlled by a single char word.

To be more explicit the HMODULE is the windows type of handle to the parallel port. HANDLE is the windows type for the handle of the serial port.

There is also a serial port configuration of the serial port that is managed by SetCommTimeouts and SetCommState that I had forgotten. This is part of the initialization to configure the port in a proper way. I am not sure this is really necessary when I see what we do with the port afterwards. Anyway you have to check what need to be done on Linux upon serial port initialization to allow controlling the port pins. The parameters used in those calls may help you to determine your Linux setup.

Philippe
admin
Site Admin
 
Posts: 153
Joined: 12, 2009 Jul Sun 7:20 pm

Re: Good project :)

Postby Death Knight » 08, 2010 Jun Tue 4:04 pm

Hello,
Hi again, with some modifications wxPIC gui working on linux natively now...
I put some linux serial port functions too but don't tested if they are working...

But I detected new problems: ICONS.
They are not properly defined properly for multi OS.
Here is the wxdoc says: "Under wxGTK, the available formats are BMP file, XPM data, XPM file, and PNG file."
So wx cannot load ico files under wxGTK. They needed to be converted to xpm files to being properly.
Could you handle this?
Death Knight
 
Posts: 53
Joined: 30, 2010 May Sun 10:18 pm

Re: Good project :)

Postby Death Knight » 08, 2010 Jun Tue 11:50 pm

Hi Philip.
I just read my PIC16F628 under wxPIC linux Port.
I wanted to say that, your designed GUI looks awful under GTK. :) I think it's because absence of the toolbar mostly.

Also lack of images make me restart program multiple times (due pics are not here, an error message appear and it don't go away because of GUI is frozen. But sometimes it's close able via button).
So this Bar icon thing block me to make progress on Serial port....

Also reading process is really really slow. ~10bytes per second. I think some problem on performance counters. But read values are looks correct :)
I will stop developing here and wait to cure that bar icon problem.

How it's working under Windows? Is it compile-able / linkable again?
How it's performance? Is it slower?

Regards,
Erdem
Death Knight
 
Posts: 53
Joined: 30, 2010 May Sun 10:18 pm

Re: Good project :)

Postby Death Knight » 09, 2010 Jun Wed 4:27 pm

Hi, I placed new version.
Ported the application from scratch and cleaned wxString's. So sticked to old WinPic code but ported via emulation layer. Thıs because dumbly moving wxChars to wxString could break somewhere unseen from to my eye at first look... Yes wxString is better and proper from my view but this count as rewire instead of port I guess. So I try to make proper PORT at this branch instead of rewrite :)
I move almost all port code to Appl.h Appl.cpp functions. Serial port related functions put to pic_hw.c

So use "posix-port" branch from now. ;)
Thanks.
Death Knight
 
Posts: 53
Joined: 30, 2010 May Sun 10:18 pm

Re: Good project :)

Postby admin » 09, 2010 Jun Wed 5:13 pm

Hi Erdem,

Good work. How did you manage to have the icons in the right capture? I had understood that they do not work (which I perfectly understand!).

I am trying to switch the icon management to XPM. I found no batch conversion tool that runs in command line. But I found one shareware, so I did the conversion without problem in batch, for this time. Then I can no longer rely on the preprocessor to automatically generate the include of all icons. Yesterday I wrote a PHP script that creates my include file. Now I have to test these new icons in the application. I hope to have enough time this evening. Later I will have also to think about a makefile to run the include auto-generation when necessary.

Philippe

PS: I saw some problem with the _T replacement with wxT. wxSmith is autogenerating code with _T for the non-translatable strings. So after the replacement either in the best case it puts back the _T or when this goes wrong it duplicates the lines with wxT with lines with _T. Are you sure that this is illegal to use _T in wxWidgets. If it is the case it will be necessary to define the _T macro under linux in all the source files that contain auto-generated code by wxSmith.
admin
Site Admin
 
Posts: 153
Joined: 12, 2009 Jul Sun 7:20 pm

Re: Good project :)

Postby admin » 09, 2010 Jun Wed 5:33 pm

I started checking the new XPM icons with my version (the very first I uploaded) so that I don't mix porting issues and XPM issues. The icons work but without the transparency :( the transparent areas have a random color
I will check in the ico converter did a correct job and if yes I will have to check in the wx code to see the difference with reading .ico and if there is a way to fix the problem. This may be longer than I expected...
admin
Site Admin
 
Posts: 153
Joined: 12, 2009 Jul Sun 7:20 pm

Re: Good project :)

Postby Death Knight » 09, 2010 Jun Wed 5:34 pm

I can convert them into XPM's and just including this files as header files make the job done. But those resource script gonna die :)
I remember that GIMP could do the job. I will place XPM versions of standard icons. Do you wanna use another icon set since this icons are really really old ans small?
I also noticed some strange strings at messages window like "20:32:48.687 %02d:%02d:%02d.%02d %ls"

Also some other problems we have and some of them solved too.
I can read & program my PIC16F628 at full speed on linux now. Just touched those performance counter functions and it's done.
But that slider appears while flashing just misplaced, it looks at top!. When I resize window or at second read/flash it became proper.

And as you can see, font sizes are needed to be touched for linux. With small makeup and LPT port routines, it looks completed porting to linux. :D
I think needed to small work also required for macOSX port...
Death Knight
 
Posts: 53
Joined: 30, 2010 May Sun 10:18 pm

Re: Good project :)

Postby admin » 09, 2010 Jun Wed 10:25 pm

You are right The Gimp seems to be the best software to create XPM. It avoids the 2 errors I encountered with 2 other software (as they have almost the same errors I though they were right). With the GIMP the transparent pixels are OK. But I will take months to get used to their ridiculous LISP-like macro language. So I converted the icons one by one :cry:

Now I got an issue when I tried to do a merge. It appears that posix_porting is not a branch but a creation from scratch so I can't merge anything with it. I will try to find a workaround for that tomorrow. But I believe that we will have either to drop the trunk or this branch to recover (dropping the trunk is probably the best choice because there is less changes attached to it, though I need to keep its name... So I need to be carefull)

The "%02d:%02d:%02d.%02d %ls" is an error I introduced when I made the changes around the _svprintf. I will fix it soon too.

Philippe
admin
Site Admin
 
Posts: 153
Joined: 12, 2009 Jul Sun 7:20 pm

PreviousNext

Return to WxPic contributions

cron