Unknown error

Discussion about Z-Uno product. Visit http://z-uno.z-wave.me for more details.
A.Harrenberg
Posts: 201
Joined: 05 Sep 2016 22:27

Re: Unknown error

Post by A.Harrenberg »

Hi PoltoS,

attached the current state of the library together with the example sketch.

Best regards,
Andreas.
Attachments
ZUNO_MFRC522.ZIP
the library
(68.16 KiB) Downloaded 282 times
ZUNO_DumpInfo_MFRC522.zip
Example sketch
(1.63 KiB) Downloaded 282 times
fhem.de - ZWave development support
p0lyg0n1
Posts: 242
Joined: 04 Aug 2016 07:14

Re: Unknown error

Post by p0lyg0n1 »

1. Don’t use things like
#define F(string_literal) (reinterpret_cast<const __FlashStringHelper *>(PSTR(string_literal)))
uCxx feels bad when It see this. :? It doesn’t support C++-cast style.
Don’t worry about warnings about deprecated null-terminated string constants.

2. Don’t do this:

while (!Serial); // Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4)

It’s a busy waiting. It works normally only on Atmels

3. Don’t use old-fashioned style of struct definition like:

Code: Select all

typedef struct {
		byte		keyByte[MF_KEY_SIZE];
} MIFARE_Key;
just use:

Code: Select all


struct MIFARE_Key {
		byte		keyByte[MF_KEY_SIZE];
};
uCxx will add «struct» keyword for all references to your struct MIFARE_Key automatically.

If you want to use old-fashioned typedef for structs:
use it like this (with defined struct name):

Code: Select all

typedef struct MIFARE_Key_s {
		byte		keyByte[MF_KEY_SIZE];
} MIFARE_Key;
4. Don't create constant vars inside headers.
uCxx makes no differences between const byte and byte and have no spetial constraints for constants.

So, uCxx will remove «const» modifier during build.

Just move

Code: Select all

byte MFRC522_firmware_referenceV0_0[64] = {
	0x00, 0x87, 0x98, 0x0f, 0x49, 0xFF, 0x07, 0x19,
	0xBF, 0x22, 0x30, 0x49, 0x59, 0x63, 0xAD, 0xCA,
	0x7F, 0xE3, 0x4E, 0x03, 0x5C, 0x4E, 0x49, 0x50,
	0x47, 0x9A, 0x37, 0x61, 0xE7, 0xE2, 0xC6, 0x2E,
	0x75, 0x5A, 0xED, 0x04, 0x3D, 0x02, 0x4B, 0x78,
	0x32, 0xFF, 0x58, 0x3B, 0x7C, 0xE9, 0x00, 0x94,
	0xB4, 0x4A, 0x59, 0x5B, 0xFD, 0xC9, 0x29, 0xDF,
	0x35, 0x96, 0x98, 0x9E, 0x4F, 0x30, 0x32, 0x8D
};
to .cpp file.

In header you can/(have to) add extern for this:

Code: Select all

extern byte MFRC522_firmware_referenceV0_0[64];
5. Don’t use enums as types.

You have to use byte/short/long (check MIN/MAX values of your enum) instead of it.

For Ex.

Code: Select all

	// <…>
	StatusCode status;
	status = getStatus();
	// <…>
	StatusCode getStatus()
	{
		return STATUS_OK;
	}
	

will be:

Code: Select all

	// <…>
	byte status;
	status = getStatus();
	// <…>
	byte getStatus()
	{
		return STATUS_OK;
	}
	


I applied all these rules to your files and library was compiled successful with my uCxx.
Some auxilary code was simplified a little.

All code attached here. Good luck.

Alex.
Attachments
ZUNO_MFRC522.zip
Updated library
(38.73 KiB) Downloaded 255 times
ZUNO_DumpInfo_MFRC522.ino.zip
Updated sketch
(2.14 KiB) Downloaded 290 times
A.Harrenberg
Posts: 201
Joined: 05 Sep 2016 22:27

Re: Unknown error

Post by A.Harrenberg »

Hi p0lyg0n1,

wow! Thank you very much. I will check the code and see if the example sketch works. I will then check the other example sketches and modify them if needed.

Also the "style" guide tips are welcome, the might be interesting also for other users that want to adapt / port some code from the Arduino.

Again, thank you very much!
Andreas.
fhem.de - ZWave development support
A.Harrenberg
Posts: 201
Joined: 05 Sep 2016 22:27

Re: Unknown error

Post by A.Harrenberg »

Hi,

strange, I can't compile your updated code without errors...

Code: Select all

Arduino: 1.6.5 (Windows 8.1), Board: "Z-Wave>ME Z-Uno, Europe, Disabled, Disabled"

C:\Users\andre\AppData\Roaming\Arduino15\packages\Z-Uno\tools\zuno_toolchain\00.08.10/zuno_toolchain/compiler build C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp/ZUNO_DumpInfo_MFRC522.cpp -r C:\Users\andre\AppData\Roaming\Arduino15\packages\Z-Uno\hardware\zw8051\2.0.6 


	************* Building Arduino Sketch *************
	C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp/ZUNO_DumpInfo_MFRC522.cpp
	***************************************************

Preprocessing file: C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\SPI.cpp with SDCPP... 
Compiling C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\SPI_sdcpp_.cpp ...
Preprocessing file: C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\Print.cpp with SDCPP... 
Compiling C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\Print_sdcpp_.cpp ...
Preprocessing file: C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\Stream.cpp with SDCPP... 
Compiling C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\Stream_sdcpp_.cpp ...
Preprocessing file: C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\HardwareSerial.cpp with SDCPP... 
Compiling C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\HardwareSerial_sdcpp_.cpp ...
Preprocessing file: C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\HLCore.cpp with SDCPP... 
Compiling C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\HLCore_sdcpp_.cpp ...
Preprocessing file: C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\ZUNO_MFRC522.cpp with SDCPP... 
Compiling C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\ZUNO_MFRC522_sdcpp_.cpp ...
Preprocessing file: C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\_ZUNO_DumpInfo_MFRC522.cpp with SDCPP... 
Compiling C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\_ZUNO_DumpInfo_MFRC522_sdcpp_.cpp ...
Preprocessing file: C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\SPI.cpp with SDCPP... 
Compiling C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\SPI_sdcpp_.cpp ...
Preprocessing file: C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\Print.cpp with SDCPP... 
Compiling C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\Print_sdcpp_.cpp ...
Preprocessing file: C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\Stream.cpp with SDCPP... 
Compiling C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\Stream_sdcpp_.cpp ...
Preprocessing file: C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\HardwareSerial.cpp with SDCPP... 
Compiling C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\HardwareSerial_sdcpp_.cpp ...
Preprocessing file: C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\HLCore.cpp with SDCPP... 
Compiling C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\HLCore_sdcpp_.cpp ...
Preprocessing file: C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\ZUNO_MFRC522.cpp with SDCPP... 
Compiling C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\ZUNO_MFRC522_sdcpp_.cpp ...
Preprocessing file: C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\_ZUNO_DumpInfo_MFRC522.cpp with SDCPP... 
Compiling C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\_ZUNO_DumpInfo_MFRC522_sdcpp_.cpp ...Compiling file "C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\LLCore_arduino.c" by means of SDCC...
sdcc: Calling preprocessor...
sdcc: sdcpp.exe -nostdinc -Wall -obj-ext=.rel -D__SDCC_STACK_AUTO -D__SDCC_MODEL_LARGE -D__SDCC_INT_LONG_REENT -D__SDCC_FLOAT_REENT -D__SDCC=3_5_0 -DSDCC=350 -D__SDCC_REVISION=9253 -D__SDCC_mcs51 -D__STDC_NO_COMPLEX__ -D__STDC_NO_THREADS__ -D__STDC_NO_ATOMICS__ -D__STDC_NO_VLA__ -isystem "C:\Users\andre\AppData\Roaming\ARDUIN~2\packages\Z-Uno\tools\ZUNO_T~1\0008~1.10\ZUNO_T~1/sdcc/\bin\..\include\mcs51" -isystem "C:\Users\andre\AppData\Roaming\ARDUIN~2\packages\Z-Uno\tools\ZUNO_T~1\0008~1.10\ZUNO_T~1/sdcc/\bin\..\include"  "C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\LLCore_arduino.c" 
sdcc: Generating code...
sdcc: Calling assembler...
sdcc: sdas8051.exe -plosgffw "LLCore_arduino.rel" "LLCore_arduino".asm
at 1: warning 119: don't know what to do with file ''. file extension unsupported
C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\LLCore_arduino.c:25: warning 85: in function NOPS unreferenced function argument : 'i'
C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\LLCore_arduino.c:208: warning 85: in function delayMicroseconds unreferenced function argument : 'value'
Compiling file "C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\SPI_ucxx.c" by means of SDCC...
sdcc: Calling preprocessor...
sdcc: sdcpp.exe -nostdinc -Wall -obj-ext=.rel -D__SDCC_STACK_AUTO -D__SDCC_MODEL_LARGE -D__SDCC_INT_LONG_REENT -D__SDCC_FLOAT_REENT -D__SDCC=3_5_0 -DSDCC=350 -D__SDCC_REVISION=9253 -D__SDCC_mcs51 -D__STDC_NO_COMPLEX__ -D__STDC_NO_THREADS__ -D__STDC_NO_ATOMICS__ -D__STDC_NO_VLA__ -isystem "C:\Users\andre\AppData\Roaming\ARDUIN~2\packages\Z-Uno\tools\ZUNO_T~1\0008~1.10\ZUNO_T~1/sdcc/\bin\..\include\mcs51" -isystem "C:\Users\andre\AppData\Roaming\ARDUIN~2\packages\Z-Uno\tools\ZUNO_T~1\0008~1.10\ZUNO_T~1/sdcc/\bin\..\include"  "C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\SPI_ucxx.c" 
sdcc: Generating code...
sdcc: Calling assembler...
sdcc: sdas8051.exe -plosgffw "SPI_ucxx.rel" "SPI_ucxx".asm
at 1: warning 119: don't know what to do with file ''. file extension unsupported
strncpyz prevented buffer overrun!
C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\SPI_ucxx.c:356: warning 85: in function __cxx__SPIClass__method__transfer0105 unreferenced local variable : 'ret'
Compiling file "C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\Print_ucxx.c" by means of SDCC...
sdcc: Calling preprocessor...
sdcc: sdcpp.exe -nostdinc -Wall -obj-ext=.rel -D__SDCC_STACK_AUTO -D__SDCC_MODEL_LARGE -D__SDCC_INT_LONG_REENT -D__SDCC_FLOAT_REENT -D__SDCC=3_5_0 -DSDCC=350 -D__SDCC_REVISION=9253 -D__SDCC_mcs51 -D__STDC_NO_COMPLEX__ -D__STDC_NO_THREADS__ -D__STDC_NO_ATOMICS__ -D__STDC_NO_VLA__ -isystem "C:\Users\andre\AppData\Roaming\ARDUIN~2\packages\Z-Uno\tools\ZUNO_T~1\0008~1.10\ZUNO_T~1/sdcc/\bin\..\include\mcs51" -isystem "C:\Users\andre\AppData\Roaming\ARDUIN~2\packages\Z-Uno\tools\ZUNO_T~1\0008~1.10\ZUNO_T~1/sdcc/\bin\..\include"  "C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\Print_ucxx.c" 
sdcc: Generating code...
sdcc: Calling assembler...
sdcc: sdas8051.exe -plosgffw "Print_ucxx.rel" "Print_ucxx".asm
at 1: warning 119: don't know what to do with file ''. file extension unsupported
C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\Print_ucxx.c:256: warning 85: in function __cxx__Print__method__write0105 unreferenced local variable : 'cxx_sloc'
Compiling file "C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\Stream_ucxx.c" by means of SDCC...
sdcc: Calling preprocessor...
sdcc: sdcpp.exe -nostdinc -Wall -obj-ext=.rel -D__SDCC_STACK_AUTO -D__SDCC_MODEL_LARGE -D__SDCC_INT_LONG_REENT -D__SDCC_FLOAT_REENT -D__SDCC=3_5_0 -DSDCC=350 -D__SDCC_REVISION=9253 -D__SDCC_mcs51 -D__STDC_NO_COMPLEX__ -D__STDC_NO_THREADS__ -D__STDC_NO_ATOMICS__ -D__STDC_NO_VLA__ -isystem "C:\Users\andre\AppData\Roaming\ARDUIN~2\packages\Z-Uno\tools\ZUNO_T~1\0008~1.10\ZUNO_T~1/sdcc/\bin\..\include\mcs51" -isystem "C:\Users\andre\AppData\Roaming\ARDUIN~2\packages\Z-Uno\tools\ZUNO_T~1\0008~1.10\ZUNO_T~1/sdcc/\bin\..\include"  "C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\Stream_ucxx.c" 
sdcc: Generating code...
sdcc: Calling assembler...
sdcc: sdas8051.exe -plosgffw "Stream_ucxx.rel" "Stream_ucxx".asm
at 1: warning 119: don't know what to do with file ''. file extension unsupported
Compiling file "C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\HardwareSerial_ucxx.c" by means of SDCC...
sdcc: Calling preprocessor...
sdcc: sdcpp.exe -nostdinc -Wall -obj-ext=.rel -D__SDCC_STACK_AUTO -D__SDCC_MODEL_LARGE -D__SDCC_INT_LONG_REENT -D__SDCC_FLOAT_REENT -D__SDCC=3_5_0 -DSDCC=350 -D__SDCC_REVISION=9253 -D__SDCC_mcs51 -D__STDC_NO_COMPLEX__ -D__STDC_NO_THREADS__ -D__STDC_NO_ATOMICS__ -D__STDC_NO_VLA__ -isystem "C:\Users\andre\AppData\Roaming\ARDUIN~2\packages\Z-Uno\tools\ZUNO_T~1\0008~1.10\ZUNO_T~1/sdcc/\bin\..\include\mcs51" -isystem "C:\Users\andre\AppData\Roaming\ARDUIN~2\packages\Z-Uno\tools\ZUNO_T~1\0008~1.10\ZUNO_T~1/sdcc/\bin\..\include"  "C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\HardwareSerial_ucxx.c" 
sdcc: Generating code...
sdcc: Calling assembler...
sdcc: sdas8051.exe -plosgffw "HardwareSerial_ucxx.rel" "HardwareSerial_ucxx".asm
at 1: warning 119: don't know what to do with file ''. file extension unsupported
Compiling file "C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\HLCore_ucxx.c" by means of SDCC...
sdcc: Calling preprocessor...
sdcc: sdcpp.exe -nostdinc -Wall -obj-ext=.rel -D__SDCC_STACK_AUTO -D__SDCC_MODEL_LARGE -D__SDCC_INT_LONG_REENT -D__SDCC_FLOAT_REENT -D__SDCC=3_5_0 -DSDCC=350 -D__SDCC_REVISION=9253 -D__SDCC_mcs51 -D__STDC_NO_COMPLEX__ -D__STDC_NO_THREADS__ -D__STDC_NO_ATOMICS__ -D__STDC_NO_VLA__ -isystem "C:\Users\andre\AppData\Roaming\ARDUIN~2\packages\Z-Uno\tools\ZUNO_T~1\0008~1.10\ZUNO_T~1/sdcc/\bin\..\include\mcs51" -isystem "C:\Users\andre\AppData\Roaming\ARDUIN~2\packages\Z-Uno\tools\ZUNO_T~1\0008~1.10\ZUNO_T~1/sdcc/\bin\..\include"  "C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\HLCore_ucxx.c" 
sdcc: Generating code...
sdcc: Calling assembler...
sdcc: sdas8051.exe -plosgffw "HLCore_ucxx.rel" "HLCore_ucxx".asm
at 1: warning 119: don't know what to do with file ''. file extension unsupported
Compiling file "C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\ZUNO_MFRC522_ucxx.c" by means of SDCC...
sdcc: Calling preprocessor...
sdcc: sdcpp.exe -nostdinc -Wall -obj-ext=.rel -D__SDCC_STACK_AUTO -D__SDCC_MODEL_LARGE -D__SDCC_INT_LONG_REENT -D__SDCC_FLOAT_REENT -D__SDCC=3_5_0 -DSDCC=350 -D__SDCC_REVISION=9253 -D__SDCC_mcs51 -D__STDC_NO_COMPLEX__ -D__STDC_NO_THREADS__ -D__STDC_NO_ATOMICS__ -D__STDC_NO_VLA__ -isystem "C:\Users\andre\AppData\Roaming\ARDUIN~2\packages\Z-Uno\tools\ZUNO_T~1\0008~1.10\ZUNO_T~1/sdcc/\bin\..\include\mcs51" -isystem "C:\Users\andre\AppData\Roaming\ARDUIN~2\packages\Z-Uno\tools\ZUNO_T~1\0008~1.10\ZUNO_T~1/sdcc/\bin\..\include"  "C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\ZUNO_MFRC522_ucxx.c" 
sdcc: Generating code...
at 1: warning 119: don't know what to do with file ''. file extension unsupported
strncpyz prevented buffer overrun!
strncpyz prevented buffer overrun!
strncpyz prevented buffer overrun!
C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\ZUNO_MFRC522_ucxx.c:549: error 91: extern definition for 'MFRC522_firmware_referenceV0_0' mismatches with declaration.
C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\ZUNO_MFRC522_ucxx.c:306: error 177: previously defined here
C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\ZUNO_MFRC522_ucxx.c:550: error 91: extern definition for 'MFRC522_firmware_referenceV1_0' mismatches with declaration.
C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\ZUNO_MFRC522_ucxx.c:307: error 177: previously defined here
C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\ZUNO_MFRC522_ucxx.c:551: error 91: extern definition for 'MFRC522_firmware_referenceV2_0' mismatches with declaration.
C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\ZUNO_MFRC522_ucxx.c:308: error 177: previously defined here
C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\ZUNO_MFRC522_ucxx.c:563: warning 85: in function __cxx__MFRC522__init03prSPISettings0505 unreferenced function argument : 'chipSelectPin'
strncpyz prevented buffer overrun!
strncpyz prevented buffer overrun!
strncpyz prevented buffer overrun!
strncpyz prevented buffer overrun!
strncpyz prevented buffer overrun!
strncpyz prevented buffer overrun!
strncpyz prevented buffer overrun!
strncpyz prevented buffer overrun!
strncpyz prevented buffer overrun!
strncpyz prevented buffer overrun!
C:\Users\andre\AppData\Local\Temp\build2862093518303055295.tmp\ZUNO_MFRC522_ucxx.c:1380: warning 185: comparison of 'signed char' with 'unsigned char' requires promotion to int
strncpyz prevented buffer overrun!
strncpyz prevented buffer overrun!
strncpyz prevented buffer overrun!
strncpyz prevented buffer overrun!
strncpyz prevented buffer overrun!
strncpyz prevented buffer overrun!
strncpyz prevented buffer overrun!
strncpyz prevented buffer overrun!
strncpyz prevented buffer overrun!
strncpyz prevented buffer overrun!
Error. SDCC returned: 1

Error compiling.
There are error that the external definition

Code: Select all

extern byte MFRC522_firmware_referenceV0_0[64];
extern byte MFRC522_firmware_referenceV1_0[64];
extern byte MFRC522_firmware_referenceV2_0[64];
mismatch the declaration

Code: Select all

byte MFRC522_firmware_referenceV0_0[64] = {
	0x00, 0x87, 0x98, 0x0f, 0x49, 0xFF, 0x07, 0x19,
	0xBF, 0x22, 0x30, 0x49, 0x59, 0x63, 0xAD, 0xCA,
	0x7F, 0xE3, 0x4E, 0x03, 0x5C, 0x4E, 0x49, 0x50,
	0x47, 0x9A, 0x37, 0x61, 0xE7, 0xE2, 0xC6, 0x2E,
	0x75, 0x5A, 0xED, 0x04, 0x3D, 0x02, 0x4B, 0x78,
	0x32, 0xFF, 0x58, 0x3B, 0x7C, 0xE9, 0x00, 0x94,
	0xB4, 0x4A, 0x59, 0x5B, 0xFD, 0xC9, 0x29, 0xDF,
	0x35, 0x96, 0x98, 0x9E, 0x4F, 0x30, 0x32, 0x8D
};
In the *_uxcc.c file the defintion looks like that

Code: Select all

extern unsigned char MFRC522_firmware_referenceV0_0[64] = BYTE;
extern unsigned char MFRC522_firmware_referenceV1_0[64] = BYTE;
extern unsigned char MFRC522_firmware_referenceV2_0[64] = BYTE;
and the declaration is

Code: Select all

unsigned char MFRC522_firmware_referenceV0_0[64] = {0x00, 0x87, 0x98, 0x0f, 0x49, 0xFF, 0x07, 0x19, 0xBF, 0x22, 0x30, 0x49, 0x59, 0x63, 0xAD, 0xCA, 0x7F, 0xE3, 0x4E, 0x03, 0x5C, 0x4E, 0x49, 0x50, 0x47, 0x9A, 0x37, 0x61, 0xE7, 0xE2, 0xC6, 0x2E, 0x75, 0x5A, 0xED, 0x04, 0x3D, 0x02, 0x4B, 0x78, 0x32, 0xFF, 0x58, 0x3B, 0x7C, 0xE9, 0x00, 0x94, 0xB4, 0x4A, 0x59, 0x5B, 0xFD, 0xC9, 0x29, 0xDF, 0x35, 0x96, 0x98, 0x9E, 0x4F, 0x30, 0x32, 0x8D};
unsigned char MFRC522_firmware_referenceV1_0[64] = {0x00, 0xC6, 0x37, 0xD5, 0x32, 0xB7, 0x57, 0x5C, 0xC2, 0xD8, 0x7C, 0x4D, 0xD9, 0x70, 0xC7, 0x73, 0x10, 0xE6, 0xD2, 0xAA, 0x5E, 0xA1, 0x3E, 0x5A, 0x14, 0xAF, 0x30, 0x61, 0xC9, 0x70, 0xDB, 0x2E, 0x64, 0x22, 0x72, 0xB5, 0xBD, 0x65, 0xF4, 0xEC, 0x22, 0xBC, 0xD3, 0x72, 0x35, 0xCD, 0xAA, 0x41, 0x1F, 0xA7, 0xF3, 0x53, 0x14, 0xDE, 0x7E, 0x02, 0xD9, 0x0F, 0xB5, 0x5E, 0x25, 0x1D, 0x29, 0x79};
So the ucxx changed the defintion/declaration to unsigned char, but I can't see why there is an error message as it still is identical in the definiton/declaration.

I also get a lot of "strncpyz prevented buffer overrun!" messages that I can't understand as they do not point to anything.

There is also an error message where a byte is compared to an int8_t.

Why can you compile the code without error and I can't??
Are you using an updated version of the compilers > 2.0.6?

Regards,
Andreas.
fhem.de - ZWave development support
A.Harrenberg
Posts: 201
Joined: 05 Sep 2016 22:27

Re: Unknown error

Post by A.Harrenberg »

Hi p0lyg0n1,

I just got the "small" library to run by reducing the stack size (thanks for all your help and all the tips for this topic).

But I also just found out that this "small" RFID library is in fact the base version for this larger MFRC522 library here, where you already helped a lot by changing the code so that it can compile.

I still have the problem that I got some compiler errors that apparently you did not have, but as there is only a very limited example sketch for this old/"small" library, I will not continue to work on that one but will instead continue to work on this larger library again.

First I will try to install the Arduino system on a linux server and see if the compiler behave different there. If you already used an updated version of the toolchain then I can only hope that the next update will be published soon ;)

Regards,
Andreas.
fhem.de - ZWave development support
A.Harrenberg
Posts: 201
Joined: 05 Sep 2016 22:27

Re: Unknown error

Post by A.Harrenberg »

Hi p0lyg0n1,

I have managed now to install the arduino IDE on a linux machine, but the compiler errors are the same than on my Windows 10 system... :(

So it seems I have to wait for the next version to fully compile it.

Best regards,
Andreas.
fhem.de - ZWave development support
A.Harrenberg
Posts: 201
Joined: 05 Sep 2016 22:27

Re: Unknown error

Post by A.Harrenberg »

Hi p0lyg0n1,

I am a little bit further now... :D

When I remove the external definiton for the array in the header file I can compile the sketch! There are still a lot of warnings but it compiles!

I can read out a single register to see that my hardware is version 2, but the sketch crashes at the first larger function call. I expect that it is also due to excessice use of stack. But I guess that I can improve from this starting point by analyzing the *rst. At the moment there are single functions that use around 30 bytes of stack alone.

Best regards,
Andreas.
fhem.de - ZWave development support
p0lyg0n1
Posts: 242
Joined: 04 Aug 2016 07:14

Re: Unknown error

Post by p0lyg0n1 »

Hi, Andreas.

I am sorry... I read this forum not so often as I want. A lot of things around this project have to be done...
Errors with externs looks like a problems with previous version of compiler. I use alpha version of newest one and some problems we fixed in this version. So, you can use it too in one or two days too :) Look for news.
A.Harrenberg
Posts: 201
Joined: 05 Sep 2016 22:27

Re: Unknown error

Post by A.Harrenberg »

Hi p0lyg0n1,

no need to apologize! You helped quite a lot.
Having an update for the compiler in a few days sounds good. I will not have soo many time in the next days but I will definitely install the update when it is published.
WIll check the "news" frequently!

Best regards,
Andreas.
fhem.de - ZWave development support
p0lyg0n1
Posts: 242
Joined: 04 Aug 2016 07:14

Re: Unknown error

Post by p0lyg0n1 »

Beta of 2.0.7 is there ;) You can try new compiler. It has some optimizations for stack usage...
Post Reply