PinguinoIDE / pinguino-ide

Open source integrated development environment (IDE)
GNU General Public License v2.0
80 stars 29 forks source link

Compile under Linux produces invalid hex (resolved) #117

Closed esternin closed 4 years ago

esternin commented 4 years ago

After a Linux installation (described in #114), I tested the 01.Basics->Blink->Blink.pde and everything compiled and worked. On both "PIC32 Pinguino Micro" and "PIC32 Pinguino OTG" the code produced blinks as expected.

However, trying 07.Display->LiquidCrystal->HelloWorld.pde or SystemClock.pde on "PIC32 Pinguino Micro" generates 50627-byte HelloWorld.hex and 49608-byte SystemClock.hex. Uploading either one and trying to run produces a garbled display. For example

[INFO] Pinguino found ...
[INFO]  - with PIC32MX440F256H (ID 0x00952053, rev. A6)
[INFO]  - with 241664 bytes free (236 KB)
[INFO]    from 0x9D005000 to 0x9D040000
[INFO]  - with Microchip USB HID Bootloader
[INFO] Erasing flash memory ...
[INFO] Uploading user program ...
[INFO] 17956 bytes written.
[INFO] HelloWorld.hex successfully uploaded.

An LED blink placed in the loop() works, so the program does reach the loop() part, but the LCD display (done in setup()) is garbled.

The exact same source codes (the v.13 example codes on this site are different from the same examples from the Windows PinguinoX.3 distribution so the older Windows codes were used for this comparison) compiles under Windows into a 22243-byte HelloWorld.hex and a 21089-byte SystemClock.hex. Uploading them under Windows works as expected. Copying only the .hex files over and uploading them (without compilation) under Linux produces an identical run to the Windows system, so the Linux loader at least seems fine.

[INFO] Pinguino found ...
[INFO]  - with PIC32MX440F256H (ID 0x00952053, rev. A6)
[INFO]  - with 241664 bytes free (236 KB)
[INFO]    from 0x9D005000 to 0x9D040000
[INFO]  - with Microchip USB HID Bootloader
[INFO] Erasing flash memory ...
[INFO] Uploading user program ...
[INFO] 7876 bytes written.
[INFO] HelloWorld.hex successfully uploaded.

Unfortunately, I could not get the same PinguinoX.3 IDE version for Linux to run, so this was what necessitated the installation of v.13. However, it seems the v.13 under Linux is producing invalid hex files.

If somebody knows where to look next, I would be able to try things out, but I am not even sure where to begin. Compiler? Libraries?

Has anybody managed to get a non-trivial project going under Linux?

esternin commented 4 years ago

Turns out, I ran into an incompatible interface change to the API.

LCD displays come in both an 8-bit and 4-bit interfaces. Earlier versions of PInguino library that provides the communications subroutines, used the upper four lines set to zero to indicate that this 8-bit call was addressing a 4-bit interface, and the current version uses the convention of the lower four lines set to zero.

As long as pinguino.cc remains dead (#115), the lack of documentation is an even more significant shortcoming, as the examples distributed with the IDE are the sole source of "documentation".

Here's what the proper "Hello, world!" initialization should look like:

   // initialize the library with the numbers of the interface pins
   //lcd.pins(RS, E,  0,  0,  0,  0, D4, D5, D6, D7); // if 4 bits used
   //lcd.pins(RS, E, D0, D1, D2, D3, D4, D5, D6, D7); // if 8 bits used

   // connect our 4-bit LCD as: RS=pin0, E=pin1, D4..D8=pin2..pin5
   lcd.pins(0, 1, 0, 0, 0, 0, 2, 3, 4, 5);

Cautiously, I am now more optimistic that v.13 is installable and working under Linux.