undeclared identifiers in functions - Flowcode V8 -Raspberry Pi 3B+

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
DrElmer
Posts: 7
Joined: Wed Sep 04, 2019 1:46 pm
Has thanked: 17 times

undeclared identifiers in functions - Flowcode V8 -Raspberry Pi 3B+

Post by DrElmer »

I am new to Flowcode (and what experience I have is using Flowcode with the PIC not the Raspberry Pi) o this may be caused by something that I an either doing or failing to do. I am running the latest version of Flowcode 8 with all of the libraries updated. Any suggestion/hints would be greatly appreciated.

The program compiles to C without error but when I attempt to Compile to chip I get a number of undeclared internal variables. If this was normal C code I would edit the header files, but I don't want to change any Maxtrix supplied files.

Device: RPI.RPI.RPI3B+
Generated by: Flowcode v8.2.2.15

Here is a copy of the errors that I get:

Code: Select all

Launching the compiler...
C:\Program Files (x86)\Flowcode\Common\Compilers\rpi\batch\rbuild.bat  "Dual Channel RS232 Monitor - Raspberry Pi 3B+" "F:\Dropbox\Flowcode\"
Building Dual Channel RS232 Monitor - Raspberry Pi 3B+
In file included from Dual Channel RS232 Monitor - Raspberry Pi 3B+.c:39:0:
Dual Channel RS232 Monitor - Raspberry Pi 3B+.c: In function 'FCD_026e1_Timer1__StartCounter':
Dual Channel RS232 Monitor - Raspberry Pi 3B+.c:176:32: error: 'INTCONbits' undeclared (first use in this function)
 #define Timer_1_Enable {st_bit(INTCON, GIE); st_bit(INTCON, TMR0IE);  cr_bit(T0CON, T0CS);  T0CON = (T0CON & 0xF0) | 0x08; }
                                ^
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\internals.c:70:26: note: in definition of macro 'CAL_APD'
  #define CAL_APD(a, b)   a##b
                          ^
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\internals.c:125:34: note: in expansion of macro 'CAL_APPEND'
      #define st_bit(var,bitno)   CAL_APPEND(var, bits.bitno) = 1
                                  ^~~~~~~~~~
Dual Channel RS232 Monitor - Raspberry Pi 3B+.c:176:25: note: in expansion of macro 'st_bit'
 #define Timer_1_Enable {st_bit(INTCON, GIE); st_bit(INTCON, TMR0IE);  cr_bit(T0CON, T0CS);  T0CON = (T0CON & 0xF0) | 0x08; }
                         ^~~~~~
Dual Channel RS232 Monitor - Raspberry Pi 3B+.c:1300:3: note: in expansion of macro 'Timer_1_Enable'
  #if (0) // 1 == 4
   ^~~~~~~~~~~~~~
Dual Channel RS232 Monitor - Raspberry Pi 3B+.c:176:32: note: each undeclared identifier is reported only once for each function it appears in
 #define Timer_1_Enable {st_bit(INTCON, GIE); st_bit(INTCON, TMR0IE);  cr_bit(T0CON, T0CS);  T0CON = (T0CON & 0xF0) | 0x08; }
                                ^
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\internals.c:70:26: note: in definition of macro 'CAL_APD'
  #define CAL_APD(a, b)   a##b
                          ^
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\internals.c:125:34: note: in expansion of macro 'CAL_APPEND'
      #define st_bit(var,bitno)   CAL_APPEND(var, bits.bitno) = 1
                                  ^~~~~~~~~~
Dual Channel RS232 Monitor - Raspberry Pi 3B+.c:176:25: note: in expansion of macro 'st_bit'
 #define Timer_1_Enable {st_bit(INTCON, GIE); st_bit(INTCON, TMR0IE);  cr_bit(T0CON, T0CS);  T0CON = (T0CON & 0xF0) | 0x08; }
                         ^~~~~~
Dual Channel RS232 Monitor - Raspberry Pi 3B+.c:1300:3: note: in expansion of macro 'Timer_1_Enable'
  #if (0) // 1 == 4
   ^~~~~~~~~~~~~~
Dual Channel RS232 Monitor - Raspberry Pi 3B+.c:176:78: error: 'T0CONbits' undeclared (first use in this function)
 #define Timer_1_Enable {st_bit(INTCON, GIE); st_bit(INTCON, TMR0IE);  cr_bit(T0CON, T0CS);  T0CON = (T0CON & 0xF0) | 0x08; }
                                                                              ^
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\internals.c:70:26: note: in definition of macro 'CAL_APD'
  #define CAL_APD(a, b)   a##b
                          ^
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\internals.c:126:31: note: in expansion of macro 'CAL_APPEND'
   #define cr_bit(var,bitno)   CAL_APPEND(var, bits.bitno) = 0
                               ^~~~~~~~~~
Dual Channel RS232 Monitor - Raspberry Pi 3B+.c:176:71: note: in expansion of macro 'cr_bit'
 #define Timer_1_Enable {st_bit(INTCON, GIE); st_bit(INTCON, TMR0IE);  cr_bit(T0CON, T0CS);  T0CON = (T0CON & 0xF0) | 0x08; }
                                                                       ^~~~~~
Dual Channel RS232 Monitor - Raspberry Pi 3B+.c:1300:3: note: in expansion of macro 'Timer_1_Enable'
  #if (0) // 1 == 4
   ^~~~~~~~~~~~~~
Dual Channel RS232 Monitor - Raspberry Pi 3B+.c:176:93: error: 'T0CON' undeclared (first use in this function)
 #define Timer_1_Enable {st_bit(INTCON, GIE); st_bit(INTCON, TMR0IE);  cr_bit(T0CON, T0CS);  T0CON = (T0CON & 0xF0) | 0x08; }
                                                                                             ^
Dual Channel RS232 Monitor - Raspberry Pi 3B+.c:1300:3: note: in expansion of macro 'Timer_1_Enable'
  #if (0) // 1 == 4
   ^~~~~~~~~~~~~~
Dual Channel RS232 Monitor - Raspberry Pi 3B+.c: In function 'FCD_026e1_Timer1__StopCounter':
Dual Channel RS232 Monitor - Raspberry Pi 3B+.c:179:29: error: 'TMR0' undeclared (first use in this function)
 #define Timer_1_CountRegLow TMR0
                             ^
Dual Channel RS232 Monitor - Raspberry Pi 3B+.c:1418:17: note: in expansion of macro 'Timer_1_CountRegLow'
   #endif
                 ^                  
In file included from Dual Channel RS232 Monitor - Raspberry Pi 3B+.c:39:0:
Dual Channel RS232 Monitor - Raspberry Pi 3B+.c:177:33: error: 'INTCONbits' undeclared (first use in this function)
 #define Timer_1_Disable {cr_bit(INTCON, TMR0IE); }
                                 ^
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\internals.c:70:26: note: in definition of macro 'CAL_APD'
  #define CAL_APD(a, b)   a##b
                          ^
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\internals.c:126:31: note: in expansion of macro 'CAL_APPEND'
   #define cr_bit(var,bitno)   CAL_APPEND(var, bits.bitno) = 0
                               ^~~~~~~~~~
Dual Channel RS232 Monitor - Raspberry Pi 3B+.c:177:26: note: in expansion of macro 'cr_bit'
 #define Timer_1_Disable {cr_bit(INTCON, TMR0IE); }
                          ^~~~~~
Dual Channel RS232 Monitor - Raspberry Pi 3B+.c:1427:3: note: in expansion of macro 'Timer_1_Disable'
   #if (0) // 1 == 3
   ^~~~~~~~~~~~~~~
Dual Channel RS232 Monitor - Raspberry Pi 3B+.c: In function 'FCD_026e1_Timer1__ResetCounter':
Dual Channel RS232 Monitor - Raspberry Pi 3B+.c:179:29: error: 'TMR0' undeclared (first use in this function)
 #define Timer_1_CountRegLow TMR0
                             ^
Dual Channel RS232 Monitor - Raspberry Pi 3B+.c:1478:3: note: in expansion of macro 'Timer_1_CountRegLow'
 /*=----------------------------------------------------------------------=*\
   ^~~~~~~~~~~~~~~~~~~
Dual Channel RS232 Monitor - Raspberry Pi 3B+.c: In function 'FCD_026e1_Timer1__GetRawCount':
Dual Channel RS232 Monitor - Raspberry Pi 3B+.c:179:29: error: 'TMR0' undeclared (first use in this function)
 #define Timer_1_CountRegLow TMR0
                             ^
Dual Channel RS232 Monitor - Raspberry Pi 3B+.c:1554:17: note: in expansion of macro 'Timer_1_CountRegLow'
   {
                 ^                  
Dual Channel RS232 Monitor - Raspberry Pi 3B+.c: At top level:
Dual Channel RS232 Monitor - Raspberry Pi 3B+.c:178:25: error: expected identifier or '(' before 'if'
 #define Timer_1_Handler if (ts_bit(INTCON, TMR0IF) && ts_bit(INTCON, TMR0IE)) {  TIM_0_INC  cr_bit(INTCON, TMR0IF); }
                         ^
Dual Channel RS232 Monitor - Raspberry Pi 3B+.c:4599:2: note: in expansion of macro 'Timer_1_Handler'
Error(s) in build!

C:\Program Files (x86)\Flowcode\Common\Compilers\rpi\batch\rbuild.bat reported error code 1
Last edited by medelec35 on Mon May 04, 2020 11:10 am, edited 1 time in total.
Reason: Placed compiler messages within a code block

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: undeclared identifiers in functions - Flowcode V8 -Raspberry Pi 3B+

Post by medelec35 »

Hi DrElmer,
Welcome to the Matrix tls forums.
I have used a code block for your compiler messages so it does take up too much space.
Can you post your flowchart as it may or may not be something you are doing wrong?
Martin

DrElmer
Posts: 7
Joined: Wed Sep 04, 2019 1:46 pm
Has thanked: 17 times

Re: undeclared identifiers in functions - Flowcode V8 -Raspberry Pi 3B+

Post by DrElmer »

No problem, my file is attached. It's still rough and far from finished, but I prefer to compile as I go to simplify debugging and yes I started out with punchcards.
Attachments
Dual Channel RS232 Monitor.fcfx
(50.11 KiB) Downloaded 180 times

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times

Re: undeclared identifiers in functions - Flowcode V8 -Raspberry Pi 3B+

Post by QMESAR »

In my opinion from the error code it looks like the code generated for the Timer function(component) is trying to configure a PIC Timer
which I am not sure if it will work on a RPI.

as a test try to disable the Functions you use for the Timer and see if it compiles then with the timer code disabled

DrElmer
Posts: 7
Joined: Wed Sep 04, 2019 1:46 pm
Has thanked: 17 times

Re: undeclared identifiers in functions - Flowcode V8 -Raspberry Pi 3B+

Post by DrElmer »

It appears that this is happening when I expose the macro to the top level, but once I do that even deleting it from the top level doesn't stop the error unless I also delete it from the macro list in "Project explorer".

If I expose the macro it converts to C with no errors, but the C code compiler errors out and if I don't expose the macro then the variables stay in the initial state.

I created the attached Flowcode file to try to isolate my problem, but it appears that I may have discovered a novel way break things yet again.

If the modules do not work with the Raspberry Pi why are they not greyed out and inaccessible? If I am doing something wrong please let me know what I need to do or not do.

I also noticed that there is an error in the help files, the help file says to use ToStr$ to convert a number to a string but this throws an error - the correct command is ToString$.
Attachments
RPI-Timestamp-Test.fcfx
(13.72 KiB) Downloaded 177 times

DrElmer
Posts: 7
Joined: Wed Sep 04, 2019 1:46 pm
Has thanked: 17 times

Re: undeclared identifiers in functions - Flowcode V8 -Raspberry Pi 3B+

Post by DrElmer »

After digging around in the C Code and it appears that the problem is that I am missing some header files:

poll.h
unistd.h
linux/fb.h
sys/mman.h

I still have version 7 installed, but I haven't been able to locate these files in that version either.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: undeclared identifiers in functions - Flowcode V8 -Raspberry Pi 3B+

Post by Benj »

Hello,

Can you post the latest project file that is showing the problem and I will investigate for you.

The timer component requires timer based interrupts to be available on your target device. Unfortunatley we either don't currently support these for the Pi or they are not available on the hardware.

Exposing macros to the top is only required for making components where you want to expose a lowere level component call into your component. You should not need to do this for a standard project that will be downloaded to a target such as the RPi.

DrElmer
Posts: 7
Joined: Wed Sep 04, 2019 1:46 pm
Has thanked: 17 times

Re: undeclared identifiers in functions - Flowcode V8 -Raspberry Pi 3B+

Post by DrElmer »

Here is my latest test file and the resulting c file. The file complies and links without error, but I can't change the background or foreground colors and the only variable that updates is the loop counter.

Is there a list of which modules don't currently work with the Raspberry Pi?

If I only expose the module, but not change it why does it behave differently when I generate the C code/compile it?
Attachments
RPI-Timestamp-Test.c
(51.38 KiB) Downloaded 184 times
RPI-Timestamp-Test.fcfx
(19.3 KiB) Downloaded 184 times

Post Reply