Compare code size between many different serial options available via PropGCC and PropWare
cmake_minimum_required(VERSION 3.3)
project(Hello_Demo C CXX SPIN2DAT)
create_simple_executable(${PROJECT_NAME}
Hello_Demo.cpp
pst.spin)
#define TEST_PROPWARE
#ifdef TEST_PROPWARE
#elif defined TEST_SIMPLE
#elif defined TEST_TINYSTREAM
#include <tinystream>
std::stream cout;
}
#elif defined TEST_TINYIO
#include <tinyio.h>
#elif defined TEST_FDSERIAL
#elif defined TEST_LIBPROPELLER
#include <libpropeller/serial/serial.h>
#endif
#ifndef TEST_PROPWARE
int _cfg_rxpin = -1;
int _cfg_txpin = -1;
int _cfg_baudrate = -1;
#endif
uint32_t i = 0;
#ifdef TEST_FDSERIAL
#elif defined TEST_LIBPROPELLER
serial.
Start(_cfg_rxpin, _cfg_txpin, _cfg_baudrate);
#endif
while (1) {
#ifdef TEST_PROPWARE
#elif defined TEST_SIMPLE
printi(
"Hello, world! %03d 0x%02x\n", i, i);
#elif defined TEST_TINYSTREAM
std::cout << "Hello, world! " << i << ' ' << i << std::endl;
#elif defined TEST_TINYIO
printf("Hello, world! %03d 0x%02x\n", i, i);
#elif defined TEST_FDSERIAL
dprinti(serial,
"Hello, world! %03d 0x%02x\n", i, i);
#elif defined TEST_LIBPROPELLER
serial.
PutFormatted(
"Hello, world! %03d 0x%02X\r\n", i, i);
#endif
i++;
waitcnt(250 * MILLISECOND + CNT);
}
return 0;
}