Hi ,
I want to perform a unit test for arduino based stm32 device. The serial output of the test device need to port to hardware serial .
Before platformio core 6.0 it was working fine with unittest_transport.h
which the code is ::
#ifndef UNITTEST_TRANSPORT_H
#define UNITTEST_TRANSPORT_H
#include <Arduino.h>
#define TESTING_SERIAL Serial1
HardwareSerial Serial1(UART4);
void unittest_uart_begin() {
/* default test_speed value */
TESTING_SERIAL.setRx(PC11);
TESTING_SERIAL.setTx(PC10);
TESTING_SERIAL.begin(115200);
}
void unittest_uart_putchar(char c) {
TESTING_SERIAL.print(c);
}
void unittest_uart_flush() {
TESTING_SERIAL.flush();
}
void unittest_uart_end() {
}
#endif
After 6.0 I had to rename the folder or file start with “test_” and need to replace unittest_transport.h with unity_config.h and unity_config.cpp according to @ivankravets .
I made the changes as below ,
unity_config.h
#ifndef UNITY_CONFIG_H
#define UNITY_CONFIG_H
#include <Arduino.h>
#ifndef NULL
#ifndef __cplusplus
#define NULL (void*)0
#else
#define NULL 0
#endif
#endif
#ifdef __cplusplus
extern “C”
{
#endif
void unityOutputStart();
void unityOutputChar(char);
void unityOutputFlush();
void unityOutputComplete();
#define UNITY_OUTPUT_START() unityOutputStart()
#define UNITY_OUTPUT_CHAR(c) unityOutputChar(c)
#define UNITY_OUTPUT_FLUSH() unityOutputFlush()
#define UNITY_OUTPUT_COMPLETE() unityOutputComplete()
#ifdef __cplusplus
}
#endif /* extern “C” /
#endif / UNITY_CONFIG_H */
and unity_config.cpp is ,
#include “unity_config.h”
#define TESTING_SERIAL Serial1
HardwareSerial Serial1(UART4);
void unityOutputStart()
{
Serial1.begin(115200);
}
void unityOutputChar(char c)
{
Serial1.print(c);
}
void unityOutputFlush()
{
Serial1.flush();
}
void unityOutputComplete()
{
}
and I’m getting the following error ,
Any idea of why this error occurs ?
Thanks,
Sam.