Compiling problem
-
- Posts: 254
- http://meble-kuchenne.info.pl
- Joined: Tue Jul 13, 2021 1:53 pm
- Has thanked: 33 times
- Been thanked: 23 times
Compiling problem
I've been working on this file for quite a while now. Out of the blue (ive been editing the flowcode but nothing which should have caused an issue). I've attached the message file and cant figure out what exactly the problem is.
- Attachments
-
- Flowcode1pcb.msg.txt
- (4.63 KiB) Downloaded 68 times
Re: Compiling problem
Hi Martin. Yes I have but i've gone through every single change and cant see why there appears to be 2 undeclared connections points. I have used copy and paste to save a bit of time but again i've gone through them all.
flowchart PM'd
flowchart PM'd
-
- Matrix Staff
- Posts: 1463
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 514 times
- Been thanked: 473 times
Re: Compiling problem
Hi
Although your project compiles for me, I have spotted some issues with it.
for example, within main you have a loop with While true, so it will always be running.
However, you have an Enable timer interrupt within the loop.
Timer interrupt Eanalbes should only be run once (unless a timer Disable icon is used first), so you must move it above the loop.
You have a component, calculation and connection point below the loop, which will never be accessed, as the loop will be running forever.
My guess is you meant to have a goto connection within the loop, but it got missed out.
Try and use loops instead of goto connections whenever you can
Withing the SaveData interrupt macro you have a fair few FileSD components and a Disable timer icon.
All interrupts should be as short as possible and the components that are used within the interrupt e.g FileSD should not be used in any other user macros otherwise corruption will occur.
The compiler messages is warning you about this, they are called non-reentrant functions
If you see that warning, don't ignore it. for example, you have messages like:
I have left a fair few messages off the list.
I have found in the past, that there is an issue if you disable an interrupt within an interrupt.
my advice would be to set a flag within the interrupt. then move all the components and Interrupt Disable to a new user macro.
Then within the new user macro, you clear the flag.
Instead of timer enables and disable's, you could use another flag called Timer4 disable for example, within the interrupt, to bypass setting the interrupt flag.
I can generate an example for you if it will help.
I hope this helps you out.
Although your project compiles for me, I have spotted some issues with it.
for example, within main you have a loop with While true, so it will always be running.
However, you have an Enable timer interrupt within the loop.
Timer interrupt Eanalbes should only be run once (unless a timer Disable icon is used first), so you must move it above the loop.
You have a component, calculation and connection point below the loop, which will never be accessed, as the loop will be running forever.
My guess is you meant to have a goto connection within the loop, but it got missed out.
Try and use loops instead of goto connections whenever you can
Withing the SaveData interrupt macro you have a fair few FileSD components and a Disable timer icon.
All interrupts should be as short as possible and the components that are used within the interrupt e.g FileSD should not be used in any other user macros otherwise corruption will occur.
The compiler messages is warning you about this, they are called non-reentrant functions
If you see that warning, don't ignore it. for example, you have messages like:
Code: Select all
C:\ProgramData\MatrixTSL\FlowcodeV9\CAL\PIC\PIC_CAL_Delay.c: 85: non-reentrant function "_delay_us" appears in multiple call graphs and has been duplicated by the compiler
C:\ProgramData\MatrixTSL\FlowcodeV9\CAL\PIC\PIC_CAL_String.c: 132: non-reentrant function "_FCI_GETLENGTH" appears in multiple call graphs and has been duplicated by the compiler
C:\ProgramData\MatrixTSL\FlowcodeV9\CAL\PIC\PIC_CAL_String.c: 377: non-reentrant function "_FCI_TOSTRING" appears in multiple call graphs and has been duplicated by the compiler
C:\ProgramData\MatrixTSL\FlowcodeV9\CAL\PIC\PIC_CAL_String.c: 542: non-reentrant function "_FCI_FLOAT_TO_STRING" appears in multiple call graphs and has been duplicated by the compiler
C:\ProgramData\MatrixTSL\FlowcodeV9\CAL\PIC\PIC_CAL_SPI.c: 285: non-reentrant function "_FC_CAL_SPI_Master_Byte_1" appears in multiple call graphs and has been duplicated by the compiler
I have found in the past, that there is an issue if you disable an interrupt within an interrupt.
my advice would be to set a flag within the interrupt. then move all the components and Interrupt Disable to a new user macro.
Then within the new user macro, you clear the flag.
Instead of timer enables and disable's, you could use another flag called Timer4 disable for example, within the interrupt, to bypass setting the interrupt flag.
I can generate an example for you if it will help.
I hope this helps you out.
Martin
Re: Compiling problem
Thanks Martin. I take all your points. The goto connection in the main loop is a relic from the first attempts at this circuit and there are a lot of variables and components to be removed. (I deleted 6 or 7 unused variables last night as an example)
I'll take up your offer of generating an example for the interrupt.
The goto connections are an easy way out of a loop and have worked well so far but I do know its not good programming practice
I'll take up your offer of generating an example for the interrupt.
The goto connections are an easy way out of a loop and have worked well so far but I do know its not good programming practice
-
- Matrix Staff
- Posts: 1463
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 514 times
- Been thanked: 473 times
Re: Compiling problem
Hi.
I have attached a basic demo.
The seconds that count within the interrupt only increment when the interrupt is allowed to increment them.
It should be noted that simulation is much faster than live on hardware.
I have attached a basic demo.
The seconds that count within the interrupt only increment when the interrupt is allowed to increment them.
It should be noted that simulation is much faster than live on hardware.
- Attachments
-
- Timer interrupt flag demo.fcfx
- (16.39 KiB) Downloaded 62 times
Martin