× CodeTyphon Cross-Build Development, discussions and problems

Question CT 7.1 kills my code

  • concrete
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
4 months 3 weeks ago #14660 by concrete
CT 7.1 kills my code was created by concrete
I have a very strange problem, and I'm hoping somebody will have a solution.

For the last few years, I've been using CT 5.9, and everything's been working great. Yesterday I decided to try CT 7.1 (clean install on a virtual machine).

I took one of my projects from CT 5.9 and converted it to 7.1 The conversion was fine, but when I was running the program, something was wrong.

The program is running on ARM Linux (RPi2), and I have a procedure which toggles one of the GPIO pins on and off at certain times. The exact same code works fine when compiled with CT 5.9, but does not work when compiled with 7.1. The majority of the program runs fine (more than 6100 lines of code), but the code which is responsible for the GPIO doesn't work. No error messages, no exceptions, no crashes - just doesn't work.

It appears that CT 7.1 is compiling the code differently from CT 5.9, and the result is a non-working routine.

I created a very simple test program to demonstrate exactly what I'm doing. Please see the attached file.

Host OS: Windows 10 Pro running 32-bit version of CT 7.1
Target OS: ARM Linux (32-bit)
Target Processor: ARM (RPi2)
Attachments:

Please Log in or Create an account to join the conversation.

More
4 months 3 weeks ago - 4 months 3 weeks ago #14661 by Matis A.
Replied by Matis A. on topic CT 7.1 kills my code
Your target arm OS ? (Raspbian , Ubuntu, etc)

PilotLogic Core Programmer
Last edit: 4 months 3 weeks ago by Matis A..

Please Log in or Create an account to join the conversation.

  • concrete
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
4 months 3 weeks ago #14662 by concrete
Replied by concrete on topic CT 7.1 kills my code
Target OS is Raspbian.

Please Log in or Create an account to join the conversation.

More
4 months 3 weeks ago #14663 by Matis A.
Replied by Matis A. on topic CT 7.1 kills my code
OK,
give me time to test and suggest, it's Sunday...

PilotLogic Core Programmer

Please Log in or Create an account to join the conversation.

More
4 months 3 weeks ago - 4 months 3 weeks ago #14664 by Matis A.
Replied by Matis A. on topic CT 7.1 kills my code
After tests and fix your code, all works OK

Test on Raspberry Pi 3 Model B+ with latest Raspbian
and LAB CodeTyphon installed for debugging.

You can download your project with my fix from here

I execute your fixed projects with command
sudo ./GPIOTest
because normal Raspbian user (pi) do NOT have permition to open /dev/mem for Read and Write
line 100 at your unit LowLevelGPIO.pas

and some live screens from my tests

LAB CT on Raspberry Pi 3 Model B+ with latest Raspbian



sudo ./GPIOTest


PilotLogic Core Programmer
Attachments:
Last edit: 4 months 3 weeks ago by Matis A..

Please Log in or Create an account to join the conversation.

  • concrete
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
4 months 3 weeks ago #14665 by concrete
Replied by concrete on topic CT 7.1 kills my code
Thank you for looking into the problem - I appreciate it.

But this is not about user permissions. The exact same code runs fine when compiled with CT 5.9. Same user, same operating system, same Pi.

My program always runs as root, not a regular user.

When I tested the program with your modification, it still behaves exactly the same way. I have an LED connected to GPIO17, and with CT 5.9, the LED can be turned on and off. With CT 7.1, the code does nothing.

Please Log in or Create an account to join the conversation.

More
4 months 3 weeks ago #14666 by Matis A.
Replied by Matis A. on topic CT 7.1 kills my code
It's better to test your project on an Raspbian Single Board PC
with CT installed for debugging

.

PilotLogic Core Programmer

Please Log in or Create an account to join the conversation.

  • concrete
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
4 months 3 weeks ago #14667 by concrete
Replied by concrete on topic CT 7.1 kills my code
I've developed half a dozen production-environment programs for the Pi (all of them running 24/7 in industrial applications). Each of them contain several thousand lines of code.

They were all developed between 2015 and 2020 using CT 5.9 in Windows, and it was never necessary to install CT on the Pi for debugging any of them.

This is not a debugging issue, and not a permission issue. There are no bugs in the code to debug.

CT 5.9 produces a program that works.
CT 7.1 produces a program that doesn't work.

Please Log in or Create an account to join the conversation.

More
4 months 3 weeks ago #14668 by Matis A.
Replied by Matis A. on topic CT 7.1 kills my code
Sir
many things in FPC changed in last 4 years.

My suggestion is to test and fix your library LowLevelGPIO.pas on a Target Hardware with CT,
it's the best approach.

We can do this for you, but we want a sample app to test.

PilotLogic Core Programmer

Please Log in or Create an account to join the conversation.

  • concrete
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
4 months 3 weeks ago #14670 by concrete
Replied by concrete on topic CT 7.1 kills my code
Yes, I certainly believe that many things have changed in FPC during the last four years. But I have tens of thousands of lines of code, and everything works fine - except for this.

The best sample app I can provide you is what I already attached in the original message. If you compile it with CT 5.9 and run it on a Pi with an LED attached to GPIO17, everything will work normally. But the same program compiled with CT 7.1 will do nothing with the LED.

Please Log in or Create an account to join the conversation.