typedef causes unrecognized opcode

randers wrote on Sunday, January 18, 2009:

Hi,

I would prefere to define some individual types in <myproject>\FreeRTOSConfig.h, like

#define BYTE unsigned char   // works

but I’d prefere

typedef unsigned char TBYTE;

But this causes a curious error: unrecognized opcode `typedef unsigned char TBYTE’

Any suggestions?

ralf

edwards3 wrote on Sunday, January 18, 2009:

>Any suggestions?

Without knowing which compiler or target you are using - no.  Although at a guess I would say TBYTE was already defined to something else.

randers wrote on Sunday, January 18, 2009:

I use  gcc version 3.4.4   Microchip MPLAB C Compiler for PIC32 MCUs v1.04-20080908

"TBYTE" is always the second choice, "BYTE" was the first choice.

I just did a third try with :  typedef unsigned char  T_MY_BYTE;

same error…

Somewhere in the www I found a connection to assembler (.S) files. not satisfying…

edwards3 wrote on Sunday, January 18, 2009:

>But this causes a curious error: unrecognized opcode `typedef unsigned char TBYTE’

Do you get a file name and line number for this error?

randers wrote on Sunday, January 18, 2009:

I just took the the original v.5.0.3-demo (just used for my other problem) and inserted the line in FreeRTOSConfig.h …

#ifndef FREERTOS_CONFIG_H
#define FREERTOS_CONFIG_H

#include <p32xxxx.h>

typedef unsigned char BYTE;
//…

compiling … ->
Executing: “C:\Programme\Microchip\MPLAB C32\bin\pic32-gcc.exe” -mprocessor=32MX460F512L -c -MMD -MF"out\port_asm.d" -I"." -I"." -I"…\common\include" -I"…\…\source\portable\mplab\pic32mx" -I"…\…\source\include" -D__DEBUG “…\…\Source\portable\MPLAB\PIC32MX\port_asm.S” -o"out\port_asm.o" -I"…\…\Source\portable\MPLAB\PIC32MX" -I"." -Wa,–defsym=__DEBUG=1,–keep-locals,–gdwarf-2
./FreeRTOSConfig.h: Assembler messages:
./FreeRTOSConfig.h:55: Error: unrecognized opcode `typedef unsigned char BYTE’
Halting build on first failure as requested.
-
–> Assembler messages ???

!!! Yeah, the FreeRTOSConfig.h seems to be lastly included in port_asm.S and there the typedef construction can not be resolved.

Any suggestions for a good place to place projects more or less individual typedef’s ?
ralf

edwards3 wrote on Sunday, January 18, 2009:

Oh yea, I see configMAX_SYSCALL_INTERRUPT_PRIORITY is used in the asm file.  That would explain it then.

You could change the asm file so it does not need the header, or alternatively you could add your definitions to Source\portable\MPLAB\PIC32MX\portmacro.h

randers wrote on Sunday, January 18, 2009:

I do not like to modify files in the source folder.
Future trouble (version conflicts) is preassigned.
So I thought, FreeRTOSConfig.h (in the projects main folder) is the best place :confused:
But I’m so free and make my own general header.
But thanks for the communication.
Lately we found the cause, that I was looking for.
ralf