TCC compiler issues

Moderators: TomKerekes, dynomotion

Post Reply
SamMarrocco
Posts: 85
Joined: Fri Apr 27, 2018 12:44 pm

TCC compiler issues

Post by SamMarrocco » Sun Dec 20, 2020 3:57 pm

I've been modifying some of my C Code that is compiled and downloaded into the KFlop during my application startup. Recently I've been having some strange intermittent issues that I'm relatively certain are related to the modifications in my C Code. Some of the symptoms are:

From vb.net, during operation of the Controller.CompileAndLoadCoff() method, my application will fail to find the KFlop Hardware, then fail to find the emc.var file (which is definitely present).

A power cycle of the KFlop then a restart of my app will run fine the first time.
The second time my app is run, I see "unable to open file emc.var but the KFlop connects fine. Examination shows that the TCC67.exe file in my application's startup folder has now disappeared. Copying that file back into my app's start folder results in normal operation.

Again, I suspect that my c code is the culprit and that whatever error is in my code is causing the compiler to crash and delete itself, but I have a few questions that may help me troubleshoot the issue:

1-I've noticed that upon power up, my KFlop does it's normal 'blinking for a few seconds" of both LEDs, then they are solid. However, the LED closest to the edge of the board is flickering intermittently from time to time for several seconds. I am powering the board from external power and can't say I've noticed this flicker before but can't say I've looked at it closely. The flicker doesn't happen at a constant rate, as though it is showing a data stream or something. Is this normal? What exactly do those two LEDs indicate?

2-The deletion of the TCC67.exe is bizarre. I'll have to play with some code to find out why this is happening as I'm sure the cause is my code. The Controller.CompileAndLoadCoff() method contains a .BypassError argument. When this is true, I suspect errors are ignored, but when it is true, what happens? Ideally I'd like to see the output from the TCC compiler so I can determine the issue. Is it possible to obtain the output from the TCC compiler during the Controller.CompileAndLoadCoff() operation? If not, can you provide the arguments you are using during this method so that I can perform the exact same compile operation (albeit without the download of the code to the KFlop) from a command line for easier debugging and viewing of the TCC output messages?

User avatar
TomKerekes
Posts: 2636
Joined: Mon Dec 04, 2017 1:49 am

Re: TCC compiler issues

Post by TomKerekes » Sun Dec 20, 2020 7:05 pm

Hi Sam,

Strange that files on the PC are disappearing. You might check any anti-virus software that falsely thinks it is a virus. We've had problems with Window's Defender. See this.

Regarding LED flicker: KFLOP flashes the LEDs at a constant rate for ~3 seconds after boot while waiting to receive a Flash Recovery command from the PC. If not received in 3 seconds, it does a secondary boot and launches any User Flashed Programs. It should never Flicker unless a User program is making it flicker. You might re-Flash New Version to make sure nothing is changed in KFLOP.

A few years ago we did receive some faulty LEDs from a vendor. Instead of the plastic being hard it was somewhat soft like rubber. Shock or vibration could cause an electrode within the LED to break and cause a failure. Or once broken, heat expansion could cause a disconnection, cool down, re-connection, etc resulting in a flicker. Does gently pushing on the LED lens with something like a toothpick feel soft and have an effect? If so, the LED is defective. This will have no effect on the operation of anything but is visually annoying.

Regarding TCC67:

If you set BypassError to false then an error string will be returned from CompileAndLoadCoff() if there is an errror. Which is either some error that KMotionDLL had executing the Compiler such as "Error Locating TCC67.exe Compiler". Or the TCC67 Compiler output if there is an error.

Here is an example command line parameter list for running TCC67.exe from the VS debugger or the command line to compile User7.c for Thread 7.

Code: Select all

-text 80090000 -g -nostdinc -I "C:\KMotion435e\DSP_KFLOP" -I "C:\KMotion435e\C Programs" -o "C:\KMotion435e\C Programs\User7(7).out" "C:\KMotion435e\C Programs\User7.c" "C:\KMotion435e\DSP_KFLOP\DSPKFLOP.out"
Regards,

Tom Kerekes
Dynomotion, Inc.

SamMarrocco
Posts: 85
Joined: Fri Apr 27, 2018 12:44 pm

Re: TCC compiler issues

Post by SamMarrocco » Sun Dec 20, 2020 8:14 pm

My familiarity with Windows had me wondering about Defender since it has a habit of becoming 're-enabled' with windows updates on a (seemingly) random occurance. However, there are currently no anti-virus apps running on this machine.

You mentioned the LEDs "should not flicker unless a user program is making it flicker". How would a user go about making them flicker? I'm wondering if I'm using a resource I shouldn't that is tied to the LED(s). I'll try a reflash in case I've overwritten something by accident as you suggested.

This doesn't look like a 'hardware connection' issue with the LEDs causing a flicker. This is sitting on my desk on a static-free mat, and the flicker definitely looks like a pattern, as though data were changing it. The flicker is very subtle and the pattern repeats. I'll try to record it for you. Maybe I'll reverse it and see it it plays 'Paul is dead." Curious.

Thanks for the TCC commandline. I'll use that to explore further and let you know what I find.

User avatar
TomKerekes
Posts: 2636
Joined: Mon Dec 04, 2017 1:49 am

Re: TCC compiler issues

Post by TomKerekes » Sun Dec 20, 2020 8:53 pm

You mentioned the LEDs "should not flicker unless a user program is making it flicker". How would a user go about making them flicker? I'm wondering if I'm using a resource I shouldn't that is tied to the LED(s).
The LEDs are IO Bits 46 and 47. Code setting/clearing those would do it. IO Bits are controlled by memory mapped FPGA registers so writing to those memory locations could also do it.
'Paul is dead."
let us know :)
Regards,

Tom Kerekes
Dynomotion, Inc.

SamMarrocco
Posts: 85
Joined: Fri Apr 27, 2018 12:44 pm

Re: TCC compiler issues

Post by SamMarrocco » Mon Dec 21, 2020 6:30 pm

Tom,
It looks like you were correct about the bad LED. I pressed on it gently and it went out. slight pressure and it comes back on. A few times and now it won't come back on at all. Other than that the board seems to be fine.

Although the flickering had such a patters to it that I would have sworn it was under software control.

Still working on the compiler exe vanishing issue.

SamMarrocco
Posts: 85
Joined: Fri Apr 27, 2018 12:44 pm

Re: TCC compiler issues

Post by SamMarrocco » Tue Dec 22, 2020 4:41 pm

The "compiler vanishing" issue continues to mystify. Here are the results of my newest tests for keeping this thread current....

I set up a minimal Vb.net application that does the minimum necessary to cause the issue. This should rule out anything in my more complex app from being the issue. I've also run these tests with my full app, which compiles and downloads 6 c code apps into the KFlop.

The minimal app basically setups and initializes the Controller, CoordMotion and Interpreter objects, returns KFlop info to verify proper operation, then runs the Controller.CompileAndLoadCoff() method to compile and download a simple C Code application into the KFlop for thread 2. The application is *not* executed; merely downloaded into the KFlop. The C Code is an empty Main() routine.

During attempts to locate the issue's cause, I have attempted the following:
-Several USB cables were tried.
-Removal of any USB Hubs between the KFlop and Windows 10 PC.
-Verification that Windows Defender was not running, nor were any other anti-virus applications present or running.
-Reinstallation of the KFlop's firmware to match the KMotion libraries on the machine and being used by my vb.net apps.
-The issue happens both from the VS.NET IDE and from already compiled vb.net applications, so it does not appear to be related to the vs IDE.
-I have run several thousand 'manual compiles' of the same C Code from the command line with tcc67.exe and it has never deleted the tcc67.exe file, so the issue does not appear to be within the tcc.exe itself.

The steps to reproduce/issues are as follows:
1)The KFlop is restarted (power off/on).
2)My application is run.
3)Sometimes my application runs fine, compiling the c Code, downloading it into the KFlop.
4)Randomly (sometimes the next run, sometimes after 20 runs) one of the following events will happen
The app compiles one or more of the C Code files, then fails with one of these errors:
a)A tiny dialog box appears on screen then vanishes too quickly to read; something about TCC error in the title.
b)Sometimes the tcc67.exe file disappears from my application directory and all compiles from that point on fail.
c) Sometimes an error appears showing "TCC67.exe - Application Error" dialog, with the content "The application was unable to start correctly (0xc00000142). Click OK to close the application."

To more rapidly test, I set up a loop of controller.CompileAndLoadCoff() events, having it perform the same compile/download to KFlop in a for/next loop of several hundred attempts. Again, totally random, failing sometimes after 50 compiles, sometimes after 200. Occasionally, the tcc exe does not start correctly, sometimes it deletes itself after running many compiles. The dotnet console shows the status and any errors that are caught.

I'm going to continue testing and have attached the simple vb.net app that demonstrates the error on my end. I am also going to test on another windows machine when I can make it available. Any thoughts are appreciated.
Attachments
KFlopTCCTester.zip
(8.28 MiB) Downloaded 286 times

User avatar
TomKerekes
Posts: 2636
Joined: Mon Dec 04, 2017 1:49 am

Re: TCC compiler issues

Post by TomKerekes » Tue Dec 22, 2020 5:26 pm

Strange. I ran it 6 times on my W10 PC from VS and don't see any errors. It takes ~39 sec for the 500 downloads with Windows Defender turned on and ~30 seconds with Defender turned off. You might try compile without downloading to see if that makes a difference, although that is similar to your command line tests.
Regards,

Tom Kerekes
Dynomotion, Inc.

SamMarrocco
Posts: 85
Joined: Fri Apr 27, 2018 12:44 pm

Re: TCC compiler issues

Post by SamMarrocco » Sat Dec 26, 2020 2:44 pm

I have had the opportunity to test on different Windows 10 machines. My dotnet code and kflop compiler run fine on two other machines, but continue to have these 'compiler failure' issues on my main development machine. Since this is my primary machine and the issue has begun relatively recently, I plan to continue trying to resolve the issue. Knowing that the issue is specific to this machine helps.

I will continue to update this thread should I find the source of the issue and a solution in case it helps someone else in the future.

PatJefferson
Posts: 2
Joined: Wed Jul 19, 2023 2:54 am

Re: TCC compiler issues

Post by PatJefferson » Thu Jul 20, 2023 10:00 am

TomKerekes wrote:
Tue Dec 22, 2020 5:26 pm
Strange. I ran it 6 times on my W10 PC from VS and don't see any errors. It takes ~39 sec for the 500 downloads with Windows Defender turned on and ~30 seconds with Defender turned off. You might try compile without downloading to see if that makes a difference, although that is similar to your command line tests.
It's really weird that you don't get any errors when you run the program multiple times on your Windows 10 PC from Visual Studio. The difference in download times with Windows Defender on and off may be related to the security scan. To further troubleshoot the issue, you could try compiling the code without downloading to see if that makes any difference. It's worth exploring this option since it aligns with your command line tests. By doing so, you might gain more insights into the potential cause of the problem. Best of luck in resolving this matter!
You can discover many games at android games, diverse genres, ready to bring you diverse and interesting gaming experiences on mobile phones.

Post Reply