Giter Club home page Giter Club logo

platformio-examples's Introduction

platformio-examples's People

Contributors

baldram avatar dzid26 avatar eerimoq avatar herrera-luis avatar ivankravets avatar jensboe avatar jpdias avatar petzah avatar rafacouto avatar valeros avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

platformio-examples's Issues

Compiling static libs for local environment

I was transitioning an existing platformio v2 project to v3, and attempting to add some tests as I went, and I was only able to include static libraries from the lib folder after changing the name of our main file form our_project_name.ino to main.cpp. I didn't see any mention of the name of your main file anywhere affecting linking to static libraries.

Is this an issue, or was I just setting something up incorrectly?
I am on a mac with OSX El Capitan v 10.11.4.

Can't compile LCD Example using Platform IO, Blink and Hello World work just fine.

Opened on Simba issues also eerimoq/simba#161

Error

...
Compiling .pioenvs/megaatmega2560/src/main.o

src/main.c: In function 'main':
src/main.c:36:29: error: storage size of 'lcd' isn't known
struct hd44780_driver_t lcd;
...

Source

#define PORT_HAS_HD44780   // I hoped adding this would solve the compilation error...
                                                      // see source for "simba.h"

#include "simba.h"

int main()
{
    struct hd44780_driver_t lcd;

    sys_start();

    hd44780_init(&lcd,
                 &pin_d8_dev,   // RS
                 &pin_d9_dev,   // ENABLE
                 &pin_d5_dev,   // DATA 4
                 &pin_d6_dev,   // DATA 5
                 &pin_d7_dev,   // DATA 6
                 &pin_d8_dev,   // DATA 7
                 2,             // ROWS
                 16);           // COLUMNS
    hd44780_start(&lcd);

    hd44780_display(&lcd, "Welcome!\r\n");
    hd44780_cursor_show(&lcd);

    while (1) {
        hd44780_put(&lcd, chan_getc(sys_get_stdin()));
    }

My LCD is wired a little differently (pin assignments are different) than the Simba example but it should still compile I would think.

Unit testing examples conveniently omit the fact that IT COSTS MONEY TO UNIT TEST

After seeing Travis CI docs that recommend PlatformIO for CI testing I put some effort into adapting the wiring-blink PlatformIO unit test example into my own sample project.

After a few hours of work (reading docs), and feeling pretty good about the progress, I ran platformio test -e uno and got this message:

$ platformio test -e uno
PlatformIO Plus (https://pioplus.com) v0.13.1
You are not logged in. Please log in to PIO Account using
`pio account login` command and try again.

If you don't have PIO Account yet, please create it using
`pio account register` command.

It's not unreasonable that you operate a service and charge money for it. However, it's inconsiderate that your documentation makes absolutely no mention of the fact that PlatformIO is a paid service, not a free program.

Question of debug Unit testing program.

Hi, I want to debug the Unit testing program 'unit-testing/calculator/', what I did is click the 'Pre-Debug' button under 'env:native', and got a feedback 'Error: Please setup environments in platformio.ini file'.
Could you please tell me how to setup environments in `platformio.ini' to fix this? Thank you!

image

Hexadecimal print display problem

Test code is as follows:
``void setup()
{
Serial.begin(115200);
}

void loop()
{
Serial.println("test...");
uint8_t ucnt = 0;
int8_t icnt = 0;

while (1)
{
ucnt ++;
icnt ++;
Serial.printf("%x %x\r\n",ucnt,icnt);
}
}
Print result
...
7a 7a
7b 7b
7c 7c
7d 7d
7e 7e
7f 7f
80 ffffff80
81 ffffff81
82 ffffff82
83 ffffff83
84 ffffff84
...
The result should also be 80, but the result is ffffff80.

Problem with platform.io and ArduinoOTA (Example BasicOTA.ino)

The example BasicOTA.ino that illustrates over the air firmware updates of ESP8266 modules compiles with Arduino IDE 1.6.8 but not with Atom/platform.io.

With the latter I get "error: 'class ArduinoOTAClass' has no member named 'getCommand'". platform.io has an obsolete version of the ArduinoOTA class. On the other hand, Arduino's version is more recent and has a getCommand method.

I'm positive that Atom, platform.io, and all packages are up to date on my computer. I'm working with NodeMCU v1.0.

Work around:
Locate Arduino's version of the ArduinoOTA class and put it into the local lib folder (lib/ArduinoOTA/ArduinoOTA.h, .cpp) of the platform.io project.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

*** [upload] /dev/cu.usbmodem1413/firmware.bin: Not a directory

Trying to run an example (mbed-blink) on the nucleo_l152re platform.

Troubles with upload-port...

platformio device list
/dev/cu.usbmodem1413

Hardware ID: USB VID:PID=0483:374B SER=066AFF565554836767235840 LOCATION=20-1
Description: STM32 STLink

sudo platformio run -e nucleo_l152re --target upload --upload-port /dev/cu.usbmodem1413

[Sat Nov 26 10:26:50 2016] Processing nucleo_l152re (platform: ststm32, board: nucleo_l152re, framework: mbed)

Verbose mode can be enabled via -v, --verbose option
Collected 7 compatible libraries
Looking for dependencies...
Project does not have dependencies
Looking for upload disk...
Use manually specified: /dev/cu.usbmodem1413
Uploading .pioenvs/nucleo_l152re/firmware.bin
*** [upload] /dev/cu.usbmodem1413/firmware.bin: Not a directory
================================================================== [ERROR] Took 1.16 seconds ==================================================================

unity.h libraty for unit testing is not compiling

Hi, I was trying to add unit test for an arduino project and I found in your documentation that you recommend to use a library called unity.h, which seems quite what was searching for. However, I was giving problems to me in the compilation so I tried the documentation example (blink) which did not work either and then I ended here. Just tested you calculator unit test example and my output was again a compilation error:

platformio ci --lib="." --board=uno ./test/
The next files/directories have been created in /tmp/tmpUPV1Fa
include - Put project header files here
lib - Put here project specific (private) libraries
src - Put project source files here
platformio.ini - Project Configuration File

Project has been successfully initialized! Useful commands:
`pio run` - process/build project from the current directory
`pio run --target upload` or `pio run -t upload` - upload firmware to a target
`pio run --target clean` - clean project (remove compiled files)
`pio run --help` - additional information
Processing uno (platform: atmelavr; board: uno; framework: arduino)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/uno.html
PLATFORM: Atmel AVR > Arduino Uno
HARDWARE: ATMEGA328P 16MHz 2KB RAM (31.50KB Flash)
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(soft)
Collected 7 compatible libraries
Scanning dependencies...
Dependency Graph
|--  0.0.2
Compiling .pioenvs/uno/src/test_common/test_calculator.cpp.o
Compiling .pioenvs/uno/src/test_desktop/test_calculator.cpp.o
src/test_common/test_calculator.cpp:17:24: fatal error: calculator.h: No such file or directory

********************************************************************
* Looking for calculator.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:calculator.h"
* Web  > https://platformio.org/lib/search?query=header:calculator.h
*
********************************************************************

#include 
^
compilation terminated.
Compiling .pioenvs/uno/src/test_embedded/test_calculator.cpp.o
src/test_desktop/test_calculator.cpp:17:24: fatal error: calculator.h: No such file or directory

********************************************************************
* Looking for calculator.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:calculator.h"
* Web  > https://platformio.org/lib/search?query=header:calculator.h
*
********************************************************************

#include 
^
compilation terminated.
Compiling .pioenvs/uno/lib8b3/arduinoUnity_ID1466/unity.c.o
Archiving .pioenvs/uno/libFrameworkArduinoVariant.a
src/test_embedded/test_calculator.cpp:18:24: fatal error: calculator.h: No such file or directory

********************************************************************
* Looking for calculator.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:calculator.h"
* Web  > https://platformio.org/lib/search?query=header:calculator.h
*
********************************************************************

#include 
^
compilation terminated.
Indexing .pioenvs/uno/libFrameworkArduinoVariant.a
Compiling .pioenvs/uno/FrameworkArduino/CDC.cpp.o
In file included from /home/lois/.platformio/lib/arduinoUnity_ID1466/src/unity.h:16:0,
from /home/lois/.platformio/lib/arduinoUnity_ID1466/src/unity.c:7:
/home/lois/.platformio/lib/arduinoUnity_ID1466/src/unity.c: In function 'UnityConcludeTest':
/home/lois/.platformio/lib/arduinoUnity_ID1466/src/unity_internals.h:255:28: warning: statement with no effect [-Wunused-value]
#define UNITY_OUTPUT_FLUSH export_flush
^
/home/lois/.platformio/lib/arduinoUnity_ID1466/src/unity_internals.h:256:28: note: in expansion of macro 'UNITY_OUTPUT_FLUSH'
#define UNITY_FLUSH_CALL() UNITY_OUTPUT_FLUSH
^
/home/lois/.platformio/lib/arduinoUnity_ID1466/src/unity.c:370:5: note: in expansion of macro 'UNITY_FLUSH_CALL'
UNITY_FLUSH_CALL();
^
/home/lois/.platformio/lib/arduinoUnity_ID1466/src/unity.c: In function 'UnityBegin':
/home/lois/.platformio/lib/arduinoUnity_ID1466/src/unity_internals.h:263:43: warning: large integer implicitly truncated to unsigned type [-Woverflow]
#define UNITY_OUTPUT_START() export_start(115200)
^
/home/lois/.platformio/lib/arduinoUnity_ID1466/src/unity.c:1212:5: note: in expansion of macro 'UNITY_OUTPUT_START'
UNITY_OUTPUT_START();
^
/home/lois/.platformio/lib/arduinoUnity_ID1466/src/unity.c: In function 'UnityEnd':
/home/lois/.platformio/lib/arduinoUnity_ID1466/src/unity_internals.h:255:28: warning: statement with no effect [-Wunused-value]
#define UNITY_OUTPUT_FLUSH export_flush
^
/home/lois/.platformio/lib/arduinoUnity_ID1466/src/unity_internals.h:256:28: note: in expansion of macro 'UNITY_OUTPUT_FLUSH'
#define UNITY_FLUSH_CALL() UNITY_OUTPUT_FLUSH
^
/home/lois/.platformio/lib/arduinoUnity_ID1466/src/unity.c:1240:5: note: in expansion of macro 'UNITY_FLUSH_CALL'
UNITY_FLUSH_CALL();
^
Compiling .pioenvs/uno/FrameworkArduino/HardwareSerial.cpp.o
*** [.pioenvs/uno/src/test_common/test_calculator.cpp.o] Error 1
*** [.pioenvs/uno/src/test_desktop/test_calculator.cpp.o] Error 1
Compiling .pioenvs/uno/FrameworkArduino/HardwareSerial0.cpp.o
*** [.pioenvs/uno/src/test_embedded/test_calculator.cpp.o] Error 1
========================================================================= [ERROR] Took 0.42 seconds ==============================

Is this library still supported/working, I'm missing something?

Thanks!

Esp8266 OTA - No answer after sending invitation

Hi GitHub Community,

I am working on enabling OTA on the esp8266 micro controller. I have setup all prerequisites, can compile the firmware and upload using USB cable successfully.
I have identified the IP address for the device using pio device monitor -b 115200.
Upon issuing the following command: pio run -e nodemcuv2 -t upload --upload-port 192.168.1.10 I get stuck after sending the invitation and do not receive a response from the device, see log below.
I found references of this problem here: https://www.penninkhof.com/2015/12/1610-over-the-air-esp8266-programming-using-platformio/ but was not able to turn this into a resolution.
Has anyone ran into this issue and how did you resolve this?

I have Linux/Ubuntu machine and my network router is NetGear.

Thanks in advance for any guidance,
-Tiest

[Sat Jan 7 13:12:55 2017] Processing nodemcuv2 (platform: espressif8266, board: nodemcuv2, framework: arduino)
Verbose mode can be enabled via -v, --verbose option
Collected 24 compatible libraries
Looking for dependencies...

Library Dependency Graph
--
-- v1.0
Looking for upload port...
Use manually specified: 192.168.1.10
Uploading .pioenvs/nodemcuv2/firmware.bin
13:12:56 [DEBUG]: Options: {'esp_ip': '192.168.1.10', 'host_port': 21165, 'image': '.pioenvs/nodemcuv2/firmware.bin', 'host_ip': '0.0.0.0', 'auth': '', 'esp_port': 8266, 'spiffs': False, 'debug': True, 'progress': True}
13:12:56 [INFO]: Starting on 0.0.0.0:21165
13:12:56 [INFO]: Upload size: 247776
13:12:56 [INFO]: Sending invitation to: 192.168.1.10
13:13:06 [ERROR]: No Answer
*** [upload] Error 1
========================== [ERROR] Took 10.98 seconds ==========================

Understanding the test harnesses

First and foremost, I want to mention how great platformio has been to improving my coding workflow and I've just started writing unit tests for my OO classes using platformio and it's been a great quality-of-life improvement.

This test snippet has been the only wrinkle in my experience so far.

void test_thermistor_is_connected() { // not robust, test by increasing temp?
  // at room temperature
  double before_temp = heater_test -> read_temp(); // takes a reading and returns it
  Serial.println(before_temp);
  heater_test -> set_pwm(30); // heats the heater for 2s, works because I'm watching a DC meter
  delay(2000);
  **double after_temp = heater_test -> read_temp();** // --> why is this returning me the same as before_temp?
  Serial.println(after_temp);
  TEST_ASSERT_GREATER_THAN(before_temp, after_temp); // always fails before after_temp == before_temp
}

This is a unit test that's supposed to detect for thermal runaway, ie a thermistor is detached. So I designed the test to take a reading, heat the heater for 2 seconds and then take a second reading and compare the two values.

The oddity: before_temp and after_temp have exactly the same double values. Hence causing the assert to fail. e.g. 64.0 is not greater than 64.0

I'm inclined to say that it could be an issue with the code elsewhere, like the thermistor library, but I've had no issues so far and when I plugged out the code into the main .ino the output was correct (after_temp is higher than before_temp).

So if you would please advice me on what might be causing this strange interaction

Here is the rest of the test code, and I could link the .cpp file too for your reference.

#include <Arduino.h>
#include <unity.h>

#include "heater.h"
#include "pin_definitions.h"

Heater *heater_test;

void setUp(void) {
  heater_test = new Heater(PID1_READ, PID1_CONT, PID1_SIG);
}

void tearDown(void) {
  delete heater_test;
}

/*
  TESTS
 */
void test_heater_instance_with_no_signal(void) {
  Heater *heater_without_signal = new Heater(PID1_READ, PID1_CONT);

  TEST_ASSERT_EQUAL(PID1_READ, heater_without_signal->_read_pin);
  TEST_ASSERT_EQUAL(PID1_CONT, heater_without_signal->_control_pin);
  TEST_ASSERT_EQUAL(-1, heater_without_signal->_signal_pin);
}

void test_heater_instance_initialisation(void) {

  TEST_ASSERT_EQUAL(PID1_READ, heater_test->_read_pin);
  TEST_ASSERT_EQUAL(PID1_CONT, heater_test->_control_pin);
  TEST_ASSERT_EQUAL(PID1_SIG, heater_test->_signal_pin);
}

void test_thermistor_is_connected() { // not robust, test by increasing temp?
  // at room temperature
  double before_temp = heater_test -> read_temp();
  Serial.println(before_temp);
  heater_test -> set_pwm(30);
  delay(2000);
  **double after_temp = heater_test -> read_temp();**
  Serial.println(after_temp);
  TEST_ASSERT_GREATER_THAN(before_temp, after_temp);
}

void test_heater_update(void) {
  TEST_ASSERT_EQUAL_FLOAT(0.0, heater_test -> current_temp);
  heater_test -> update();
  TEST_ASSERT_GREATER_THAN(5, heater_test -> current_temp); // should be higher than zero
}

void test_heater_set_max(void) {
  heater_test -> set_max();
  TEST_ASSERT_EQUAL_FLOAT(PWM_PERCENT_MAX, heater_test -> pwm_state);
}

void test_heater_is_near_threshold() {
  heater_test -> crit_temp = 110.0;
  heater_test -> threshold_range = 10.0;
  heater_test -> current_temp = 99.0;
  TEST_ASSERT_FALSE(heater_test -> is_near_threshold());
  heater_test -> current_temp = 101.0;
  TEST_ASSERT_TRUE(heater_test -> is_near_threshold());
}

void test_heater_is_too_hot() {
  heater_test -> crit_temp = 110.0;
  heater_test -> current_temp = 110.1;
  TEST_ASSERT_TRUE(heater_test -> is_too_hot());

  heater_test -> current_temp = 109.99;
  TEST_ASSERT_FALSE(heater_test -> is_too_hot());
}

void test_heater_pid_never_overheats() {
}


void test_heater_on_and_off() {
  TEST_ASSERT_EQUAL(0, heater_test -> pwm_state);
  heater_test -> set_pwm(30);
  TEST_ASSERT_EQUAL(30, heater_test -> pwm_state);
  heater_test -> turn_off();
  TEST_ASSERT_EQUAL(0, heater_test -> pwm_state);
}

/* 
  MAIN
 */

void setup() {
    // NOTE!!! Wait for >2 secs
    // if board doesn't support software reset via Serial.DTR/RTS
    delay(2000);

    UNITY_BEGIN();    // IMPORTANT LINE!
    RUN_TEST(test_heater_instance_with_no_signal);
    RUN_TEST(test_heater_instance_initialisation);
    RUN_TEST(test_thermistor_is_connected);
    RUN_TEST(test_heater_update);
    RUN_TEST(test_heater_set_max);
    RUN_TEST(test_heater_is_near_threshold);
    RUN_TEST(test_heater_is_too_hot);
    RUN_TEST(test_heater_on_and_off);
    RUN_TEST(test_heater_pid_never_overheats);
    UNITY_END(); // stop unit testing
}

void loop() {
  delay(1);
}

arduino-mock does not compile with platformio 4.1.0

Trying the native example for arduino-mock fails while compiling. The "Arduino.h" header is not found. It does exist in the ArduinoFake-Lib for the native target. There might be a missing -I for the gcc to find the native libs.

➜  arduino-mock git:(develop) ✗ pio test -v
Verbose mode can be enabled via `-v, --verbose` option
Collected 1 items

Processing * in native environment
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Building...
Verbose mode can be enabled via `-v, --verbose` option
PACKAGES: 
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 1 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <MyService>
Building in release mode
Compiling .pio/build/native/test/test_my_service.o
Compiling .pio/build/native/libd56/MyService/MyService.o
test/test_my_service.cpp:1:10: fatal error: 'Arduino.h' file not found
#include <Arduino.h>
         ^~~~~~~~~~~
In file included from lib/MyService/MyService.cpp:1:
lib/MyService/MyService.h:3:10: fatal error: 'Arduino.h' file not found
#include <Arduino.h>
         ^~~~~~~~~~~
1 error generated.
*** [.pio/build/native/libd56/MyService/MyService.o] Error 1
1 error generated.
*** [.pio/build/native/test/test_my_service.o] Error 1
========================================================================================================================== [FAILED] Took 1.24 seconds ==========================================================================================================================

Test    Environment    Status    Duration
------  -------------  --------  ------------
*       native         FAILED    00:00:01.244
===================================================================================================================== 1 failed, 0 succeeded in 00:00:01.244 =====================================================================================================================
➜  arduino-mock git:(develop) ✗ pio --version
PlatformIO, version 4.1.0

lpmsp430fr6989 detection error

I am trying to get this board http://www.ti.com/tool/msp-exp430fr6989 working with platformio. Below is my code:

[env:lpmsp430fr6989]
platform = timsp430
board = lpmsp430fr6989
framework = energia
#include <Energia.h>
void setup() {
    pinMode(RED_LED, OUTPUT);     // set pin as output
}

void loop() {
    digitalWrite(RED_LED, HIGH);  // set the LED on
    delay(1000);                  // wait for a second
    digitalWrite(RED_LED, LOW);   // set the LED off
    delay(1000);                  // wait for a second
}

I this when I try to build:

"/Users/vbabiy/Library/Application Support/JetBrains/Toolbox/apps/CLion/ch-0/163.7743.47/CLion.app/Contents/bin/cmake/bin/cmake" --build /Users/vbabiy/Projects/platformio/ti/cmake-build-debug --target PLATFORMIO_BUILD -- -j 8
[Fri Dec  2 12:54:04 2016] Processing lpmsp430fr6989 (platform: timsp430, board: lpmsp430fr6989, framework: energia)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
Collected 25 compatible libraries
Looking for dependencies...
Project does not have dependencies
Compiling .pioenvs/lpmsp430fr6989/src/main.o
Compiling .pioenvs/lpmsp430fr6989/FrameworkEnergia/HardwareSerial.o
Compiling .pioenvs/lpmsp430fr6989/FrameworkEnergia/IPAddress.o
Compiling .pioenvs/lpmsp430fr6989/FrameworkEnergia/MACAddress.o
Compiling .pioenvs/lpmsp430fr6989/FrameworkEnergia/Print.o
In file included from /Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Energia.h:4:0,
from src/main.cpp:1:
/Users/vbabiy/.platformio/packages/toolchain-timsp430/bin/../lib/gcc/msp430/4.6.3/../../../../msp430/include/msp430.h:813:2: warning: #warning Unable to identify and include MCU header, use -mmcu=MCU [-Wcpp]
In file included from /Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Energia.h:4:0,
from /Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Arduino.h:3,
from /Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/IPAddress.cpp:2:
/Users/vbabiy/.platformio/packages/toolchain-timsp430/bin/../lib/gcc/msp430/4.6.3/../../../../msp430/include/msp430.h:813:2: warning: #warning Unable to identify and include MCU header, use -mmcu=MCU [-Wcpp]
In file included from /Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Energia.h:4:0,
from /Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/HardwareSerial.cpp:36:
/Users/vbabiy/.platformio/packages/toolchain-timsp430/bin/../lib/gcc/msp430/4.6.3/../../../../msp430/include/msp430.h:813:2: warning: #warning Unable to identify and include MCU header, use -mmcu=MCU [-Wcpp]
Compiling .pioenvs/lpmsp430fr6989/FrameworkEnergia/Stream.o
In file included from /Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Energia.h:4:0,
from /Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Arduino.h:3,
from /Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/MACAddress.cpp:2:
/Users/vbabiy/.platformio/packages/toolchain-timsp430/bin/../lib/gcc/msp430/4.6.3/../../../../msp430/include/msp430.h:813:2: warning: #warning Unable to identify and include MCU header, use -mmcu=MCU [-Wcpp]
Compiling .pioenvs/lpmsp430fr6989/FrameworkEnergia/TimerSerial.o
In file included from /Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Energia.h:4:0,
from /Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Print.cpp:27:
/Users/vbabiy/.platformio/packages/toolchain-timsp430/bin/../lib/gcc/msp430/4.6.3/../../../../msp430/include/msp430.h:813:2: warning: #warning Unable to identify and include MCU header, use -mmcu=MCU [-Wcpp]
In file included from /Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Energia.h:4:0,
from /Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Arduino.h:3,
from /Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Stream.cpp:23:
/Users/vbabiy/.platformio/packages/toolchain-timsp430/bin/../lib/gcc/msp430/4.6.3/../../../../msp430/include/msp430.h:813:2: warning: #warning Unable to identify and include MCU header, use -mmcu=MCU [-Wcpp]
Compiling .pioenvs/lpmsp430fr6989/FrameworkEnergia/Tone.o
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Stream.cpp: In member function 'bool Stream::find(char*)':
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Stream.cpp:78:30: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
In file included from /Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Energia.h:4:0,
from /Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:32:
/Users/vbabiy/.platformio/packages/toolchain-timsp430/bin/../lib/gcc/msp430/4.6.3/../../../../msp430/include/msp430.h:813:2: warning: #warning Unable to identify and include MCU header, use -mmcu=MCU [-Wcpp]
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp: In member function 'void TimerSerial::begin(long unsigned int)':
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:100:14: error: 'DEBUG_UARTRXD' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:100:29: error: 'DEBUG_UARTRXD_SET_MODE' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:101:14: error: 'DEBUG_UARTTXD' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:101:29: error: 'DEBUG_UARTTXD_SET_MODE' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:103:5: error: 'TA0CCTL0' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:103:16: error: 'OUT' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:104:5: error: 'TA0CCTL1' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:104:16: error: 'SCS' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:104:22: error: 'CM1' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:104:28: error: 'CAP' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:104:34: error: 'CCIE' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:105:5: error: 'TA0CTL' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:105:14: error: 'TASSEL_2' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:105:25: error: 'MC_2' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:105:32: error: 'TACLR' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp: In member function 'void TimerSerial::end()':
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:117:12: error: 'TA0CCTL0' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:117:23: error: 'CCIE' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:120:10: error: 'DEBUG_UARTTXD' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp: In member function 'virtual void TimerSerial::flush()':
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:146:12: error: 'TA0CCTL0' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:146:23: error: 'CCIE' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp: In member function 'virtual size_t TimerSerial::write(uint8_t)':
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:168:12: error: 'TA0CCTL0' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:168:23: error: 'CCIE' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:175:5: error: 'TA0CCR0' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:175:15: error: 'TA0R' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:177:5: error: 'TA0CCTL0' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:177:16: error: 'OUTMOD0' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:177:26: error: 'CCIE' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp: At global scope:
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:209:26: error: 'TIMER0_A0_VECTOR' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp: In function 'void TimerSerial__TxIsr()':
Compiling .pioenvs/lpmsp430fr6989/FrameworkEnergia/WInterrupts.o
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:212:13: error: interrupt vector offset must be an even non-negative integer constant
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:214:5: error: 'TA0CCR0' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:216:5: error: 'TA0CCTL0' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:216:17: error: 'OUTMOD2' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:222:22: error: 'CCIE' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp: At global scope:
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:244:26: error: 'TIMER0_A1_VECTOR' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp: In function 'void TimerSerial__RxIsr()':
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:247:13: error: interrupt vector offset must be an even non-negative integer constant
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:251:18: error: 'TA0IV' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:253:32: error: 'TA0CCTL1' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:255:5: error: 'TA0CCR1' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:257:20: error: 'CAP' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/TimerSerial.cpp:263:24: error: 'SCCI' was not declared in this scope
In file included from /Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Energia.h:4:0,
from /Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/wiring_private.h:37,
from /Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp:40:
/Users/vbabiy/.platformio/packages/toolchain-timsp430/bin/../lib/gcc/msp430/4.6.3/../../../../msp430/include/msp430.h:813:2: warning: #warning Unable to identify and include MCU header, use -mmcu=MCU [-Wcpp]
Compiling .pioenvs/lpmsp430fr6989/FrameworkEnergia/WMath.o
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp: In function 'void initTimers()':
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp:135:3: error: 'TA0CCTL0' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp:136:3: error: 'TA0CCTL1' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp:140:3: error: 'TA0CTL' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp:140:12: error: 'TACLR' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp:140:20: error: 'TASSEL_2' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp:140:32: error: 'ID_3' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp:140:39: error: 'MC_2' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp: In function 'void setTimer(uint8_t, unsigned int, long unsigned int)':
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp:164:15: error: 'TA0CCTL0' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp:164:26: error: 'CCIE' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp:164:34: error: 'TA0CCR0' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp:164:44: error: 'TA0R' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp:165:7: error: 'TA0CCTL0' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp:165:18: error: 'CCIE' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp:168:14: error: 'TA0CCTL1' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp:168:33: error: 'TA0CCR1' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp:168:43: error: 'TA0R' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp:169:7: error: 'TA0CCTL1' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp: In function 'void stopTimer(uint8_t)':
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp:185:13: error: 'TA0CCTL0' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp:186:13: error: 'TA0CCTL1' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp: At global scope:
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp:206:26: error: 'TIMER0_A0_VECTOR' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp: In function 'void TIMER0_A0_ISR()':
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp:207:6: error: interrupt vector offset must be an even non-negative integer constant
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp:209:3: error: 'TA0CCR0' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp: At global scope:
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp:213:26: error: 'TIMER0_A1_VECTOR' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp: In function 'void TIMER0_A1_ISR()':
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp:214:6: error: interrupt vector offset must be an even non-negative integer constant
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp:216:12: error: 'TA0IV' was not declared in this scope
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Tone.cpp:218:15: error: 'TA0CCR1' was not declared in this scope
*** [.pioenvs/lpmsp430fr6989/FrameworkEnergia/TimerSerial.o] Error 1
*** [.pioenvs/lpmsp430fr6989/FrameworkEnergia/Tone.o] Error 1
In file included from /Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/Energia.h:4:0,
from /Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/wiring_private.h:37,
from /Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/WInterrupts.c:38:
/Users/vbabiy/.platformio/packages/toolchain-timsp430/bin/../lib/gcc/msp430/4.6.3/../../../../msp430/include/msp430.h:813:2: warning: #warning Unable to identify and include MCU header, use -mmcu=MCU [-Wcpp]
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/WInterrupts.c: In function 'attachInterrupt':
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/WInterrupts.c:81:4: error: 'P1IES' undeclared (first use in this function)
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/WInterrupts.c:81:4: note: each undeclared identifier is reported only once for each function it appears in
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/WInterrupts.c:84:13: error: 'P1IN' undeclared (first use in this function)
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/WInterrupts.c:86:3: error: 'P1IFG' undeclared (first use in this function)
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/WInterrupts.c:88:3: error: 'P1IE' undeclared (first use in this function)
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/WInterrupts.c: In function 'detachInterrupt':
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/WInterrupts.c:144:3: error: 'P1IE' undeclared (first use in this function)
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/WInterrupts.c: In function 'Port_1':
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/WInterrupts.c:175:6: error: interrupt vector offset 'PORT1_VECTOR' is not an integer constant
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/WInterrupts.c:181:7: error: 'P1IFG' undeclared (first use in this function)
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/WInterrupts.c:184:5: error: 'P1IES' undeclared (first use in this function)
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/WInterrupts.c:185:15: error: 'P1IN' undeclared (first use in this function)
/Users/vbabiy/.platformio/packages/framework-energiamsp430/cores/msp430/WInterrupts.c:194:29: error: 'LPM4_bits' undeclared (first use in this function)
*** [.pioenvs/lpmsp430fr6989/FrameworkEnergia/WInterrupts.o] Error 1
========================== [ERROR] Took 0.82 seconds ==========================
make[3]: *** [CMakeFiles/PLATFORMIO_BUILD] Error 1
make[2]: *** [CMakeFiles/PLATFORMIO_BUILD.dir/all] Error 2
make[1]: *** [CMakeFiles/PLATFORMIO_BUILD.dir/rule] Error 2
make: *** [PLATFORMIO_BUILD] Error 2

need good first example for unit testing

Hi there!

I'm trying to make unit tests during my dev. And after many time to understand something about. I'm facing of an error when i try to making tests.

I'm on platformio VSCode
core: 4.3.4
Home: 3.2.3

On windows 10 Pro
Version 1909
Os Build 18363.959

my platformio.ini

[env:pro16MHzatmega328]
platform = atmelavr
board = pro16MHzatmega328
framework = arduino
monitor_speed = 115200
upload_port=COM4
; test_build_project_src = yes

[env:uno]
platform = atmelavr
board = uno
framework = arduino
monitor_speed = 115200
upload_port=COM5

my main.h

#ifndef MAIN_H
#define MAIN_H
#include <Arduino.h>

#define ARRAY_SIZE(arr) int(sizeof(arr) / sizeof(arr[0]))

/**
 * @brief array of pins for pumps in1 & in2
 * 
 */
const int PUMPS_PINS[5] = {2, 3, 4, 5, 6};
const int PUMPS_PINS_TODO[5] = {15, 16, 17, 18, 19};
const int BUTTONS_PINS[5] = {20, 21, 22, 23, 24};

#endif // MAIN_H

my main.cpp

#include <main.h>
/**
 * @brief Last Debounce Time stored > input noise filter
 * 
 */
unsigned long lastDebounceTime;

/**
 * @brief Delay between button pressed 2 times acceptance
 * 
 */
unsigned long debounceDelay = 200;

void setup()
{
  // Init Serial
  Serial.begin(115200);

  /**
   * @brief Init pins to output
   * 
   */
  for (int i = 0; i < ARRAY_SIZE(PUMPS_PINS_TODO); i++)
  {
    pinMode(PUMPS_PINS_TODO[i], OUTPUT);
  }

  /**
   * @brief Init pins to input
   * 
   */
  for (int i = 0; i < ARRAY_SIZE(BUTTONS_PINS); i++)
  {
    pinMode(BUTTONS_PINS[i], INPUT);
  }
}
/**
 * @brief global index depend of the number of pumps
 * 
 */
int idx = 0;

void loop()
{
  /**
   * @brief debounce physicals buttons
   * 
   */
  bool debounce = (millis() - lastDebounceTime) > debounceDelay;

  /**
   * @brief if idx > water pumps number reset to 0
   * 
   */
  (idx < ARRAY_SIZE(waterPump.pumps)) ? ++idx : idx = 0;
  if (digitalRead(BUTTONS_PINS[idx] )== HIGH && debounce )
  {
      digitalWrite(PUMPS_PINS_TODO[idx], HIGH);
      lastDebounceTime = millis();
  }
  else
  {
      digitalWrite(PUMPS_PINS_TODO[idx], LOW);
  }
  delay(100); // cadencing loop to 100ms
}

my test_main.cpp

#include <Arduino.h>
#include <unity.h>
#include <main.h>

/**
 * @brief unit tests
 *  
 */

// void setUp(void) {
// // set stuff up here
// }

// void tearDown(void) {
// // clean stuff up here
// }

void test_pumps_pin_number(int ppId)
{
    TEST_ASSERT_EQUAL(PUMPS_PINS_TODO[ppId], PUMPS_PINS[ppId]);
}

void test_pump_state_high(int ppId)
{
    digitalWrite(PUMPS_PINS[ppId], HIGH);
    TEST_ASSERT_EQUAL(HIGH, digitalRead(PUMPS_PINS[ppId]));
}

void test_pump_state_low(int ppId)
{
    digitalWrite(PUMPS_PINS[ppId], LOW);
    TEST_ASSERT_EQUAL(LOW, digitalRead(PUMPS_PINS[ppId]));
}

uint8_t i = 0;

void setup()
{
    // NOTE!!! Wait for >2 secs
    // if board doesn't support software reset via Serial.DTR/RTS
    delay(2000);
    UNITY_BEGIN(); // IMPORTANT LINE!
    for (int i = 0; i < ARRAY_SIZE(PUMPS_PINS_TODO); i++)
    {
        RUN_TEST(test_pumps_pin_number(i));
        pinMode(PUMPS_PINS_TODO[i], OUTPUT);
    }
}

void loop()
{
    if (i < ARRAY_SIZE(PUMPS_PINS_TODO))
    {
        RUN_TEST(test_pump_state_high(i));
        delay(500);
        RUN_TEST(test_pump_state_low(i));
        delay(500);
        i++;
    }
    else if (i == ARRAY_SIZE(PUMPS_PINS_TODO))
    {
        UNITY_END(); // stop unit testing
    }
}

The error

In file included from C:\Users\mickaponik.platformio\packages\tool-unity/unity.h:21:0,
from test\test_main.cpp:2:
test\test_main.cpp: In function 'void setup()':
C:\Users\mickaponik.platformio\packages\tool-unity/unity_internals.h:707:65: error: invalid use of void expression
#define RUN_TEST(func) UnityDefaultTestRun(func, #func, LINE)

So is it possible to pass an argument on test_methods() ?

platformio-examples "Blink" doesn't work

Hello,
I installed Atom with PlatformIO (actuell Releases) and started with the example "Blink".
It is not possible, to compile thate code.
This is te message:
#############################
No dependencies
Compiling .pioenvs\esp32dev\src\main.cpp.o
Compiling .pioenvs\esp32dev\FrameworkArduino\base64.cpp.o
Compiling .pioenvs\esp32dev\FrameworkArduino\cbuf.cpp.o
Compiling .pioenvs\esp32dev\FrameworkArduino\esp32-hal-adc.c.o
Compiling .pioenvs\esp32dev\FrameworkArduino\esp32-hal-bt.c.o
src\main.cpp: In function 'void setup()':

src\main.cpp:15:11: error: 'LED_BUILTIN' was not declared in this scope
pinMode(LED_BUILTIN, OUTPUT);
^
src\main.cpp: In function 'void loop()':
src\main.cpp:21:16: error: 'LED_BUILTIN' was not declared in this scope
digitalWrite(LED_BUILTIN, HIGH);
^
*** [.pioenvs\esp32dev\src\main.cpp.o] Error 1
[ERROR] Took 3.39 seconds
############################################
Does anyone knows, what's happening?
Thank you very much for your answers!

Regards

kleinlaut

UnitTesting example calculator file/folder layout seems only to work with single component in native and embedded environment

The unit testing example calculator aims to show how to use unit testing with native and embedded environments (with the Unity testing framework). The suggested file/folder structure and the contents of the test components test_embedded and test_desktop however only seem to work with a single test file - due to the definition of main and setup/loop. When adding multiple test files with that structure we certainly get compilation errors like this:

multiple definition of `main'; .....cpp:(.text+0x5f): first defined here

Besides the setUp and tearDown function will cause duplicates as well. It seems that one would have to move the main function to a separate file and reference all the other tests from there.

I am just pointing this out, as the file/folder structure after such a change would differ greatly from the example and the accompanying documentation. And this - imo - makes it a mediocre example.

I would like to see a unit test example that can easily be extended and be used in a real life project. Maybe I am missing something here, then pls tell me so and I am more than happy to delete/close this issue.

Thank you for your help and support.

Error: No such command "device"

Hello,

I have just installed PlatformIO trying to use this software instead of INO.
Though, when I run the command: platformio device list I get the following output:

Usage: platformio [OPTIONS] COMMAND [ARGS]...

Error: No such command "device"

My platformio version is: 3.3.0a7
Has someone had similar problems?

Thank you.

F1 libs are unusable

Hi! Tried yor STM32 HAL cube examples and they are compiling excellent for the default board 'nucleo_f401re'.
But right after I've changed the target board to 'genericSTM32F103CB' with build_flags = -DF1 the build fails with a lot of library errors. The most weird is that uint_8 and similar types are not recognized because of stdint.h is not linked.
Also I noticed there is a newer HAL library version 1.6.0 available for F1 family since May 17, 2017 but Platformio delivers old version 1.4.0

Unittesting wont work on STM32F407 Discovery Board

https://docs.platformio.org/en/latest/tutorials/ststm32/stm32cube_debugging_unit_testing.html

Followed the above steps exactly and updated platform.io as follows...

[env:disco_f407vg]
platform = ststm32
board = disco_f407vg
framework = stm32cube
test_transport = custom

Result

> Executing task: C:\Users\kevin\.platformio\penv\Scripts\platformio.exe test --environment disco_f407vg <

Verbose mode can be enabled via `-v, --verbose` option
Collected 1 items

Processing * in disco_f407vg environment
------------------------------------------------------------------------------------------------------------Building...
C:\Users\kevin\.platformio\packages\framework-stm32cubef4\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_smbus.c: In function 'SMBUS_MasterTransmit_TXE':
C:\Users\kevin\.platformio\packages\framework-stm32cubef4\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_smbus.c:1928:12: warning: unused variable 'CurrentMode' [-Wunused-variable]
   uint32_t CurrentMode        = hsmbus->Mode;
            ^~~~~~~~~~~
C:\Users\kevin\.platformio\packages\framework-stm32cubef4\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_smbus.c: In function 'SMBUS_Master_ADDR':
C:\Users\kevin\.platformio\packages\framework-stm32cubef4\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_smbus.c:2272:12: warning: unused variable 'CurrentXferOptions' [-Wunused-variable]
   uint32_t CurrentXferOptions = hsmbus->XferOptions;
            ^~~~~~~~~~~~~~~~~~
C:\Users\kevin\.platformio\packages\framework-stm32cubef4\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_smbus.c:2271:12: warning: unused variable 'CurrentMode' [-Wunused-variable]
   uint32_t CurrentMode        = hsmbus->Mode;
            ^~~~~~~~~~~
Uploading...
xPack OpenOCD, x86_64 Open On-Chip Debugger 0.11.0-00155-ge392e485e (2021-03-15-16:44)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
debug_level: 1

srst_only separate srst_nogate srst_open_drain connect_deassert_srst

target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x080011b0 msp: 0x20020000
** Programming Started **
** Programming Finished **
** Verify Started **
** Verified OK **
** Resetting Target **
shutdown command invoked
Testing...
If you don't see any output for the first 10 secs, please reset board (press reset button)

There is no reset button on this board and I can't seem to find a work around.

Wifi Scan

Good afternoon, I'm trying to set the esp32 in PlataformIO but when I tried to run the WIFI scan program that comes in the example shared me the next error.

screen shot 2017-11-01 at 15 19 43

** [upload] /dev/ttyACM0/firmware.bin: Not a directory

Hi all.
I'm trying to run an example on a Freescale board. Building is OK but I can't upload file to the board.
Here is my upload command and its output:

pio run --target upload --upload-port /dev/ttyACM0 -v
[Thu Aug 17 20:47:00 2017] Processing frdm_kl46z (platform: freescalekinetis; upload_port: /dev/ttyACM0; board: frdm_kl46z; framework: mbed)
---------------------------------------------------------------------------------------------------------
Collected 22 compatible libraries
Looking for dependencies...
Project does not have dependencies
MethodWrapper(["upload"], [".pioenvs/frdm_kl46z/firmware.bin"])
Use manually specified: /dev/ttyACM0
MethodWrapper(["upload"], [".pioenvs/frdm_kl46z/firmware.bin"])
*** [upload] /dev/ttyACM0/firmware.bin: Not a directory
======================================= [ERROR] Took 1.32 seconds =======================================

I searched a lot on Google but there's no information can help me. So I create an issue here.
Thank you!

AtmelAVR: Broken example links

http://docs.platformio.org/en/latest/platforms/atmelavr.html#examples
Caused by 7799fbd, fix below:

diff --git a/platforms/atmelavr_extra.rst b/platforms/atmelavr_extra.rst
index 14fe25e..0ac4607 100644
--- a/platforms/atmelavr_extra.rst
+++ b/platforms/atmelavr_extra.rst
@@ -172,13 +172,12 @@ Examples
 --------
 
 All project examples are located in PlatformIO repository
-`Examples for Atmel AVR platform <https://github.com/platformio/platformio-examples/tree/develop/atmelavr-and-arduino>`_.
-
-* `Wiring Blink <https://github.com/platformio/platformio-examples/tree/develop/wiring-blink>`_
-* `Arduino with external libraries <https://github.com/platformio/platformio-examples/tree/develop/atmelavr-and-arduino/arduino-external-libs>`_
-* `Arduino with internal libraries <https://github.com/platformio/platformio-examples/tree/develop/atmelavr-and-arduino/arduino-internal-libs>`_
-* `Project uses source file name for "src" directory (Arduino project structure) <https://github.com/platformio/platformio-examples/tree/develop/atmelavr-and-arduino/arduino-own-src_dir>`_
-* `Atmel AVR Native blink <https://github.com/platformio/platformio-examples/tree/develop/atmelavr-and-arduino/atmelavr-native-blink>`_
-* `Digitstump Mouse <https://github.com/platformio/platformio-examples/tree/develop/atmelavr-and-arduino/digitstump-mouse>`_
-* `Engduino magnetometer <https://github.com/platformio/platformio-examples/tree/develop/atmelavr-and-arduino/engduino-magnetometer>`_
-* `PanStamp blink <https://github.com/platformio/platformio-examples/tree/develop/atmelavr-and-arduino/panstamp-blink>`_
+`Examples for Atmel AVR platform <https://github.com/platformio/platformio-examples/tree/develop/atmelavr>`_.
+
+* `Wiring Blink <https://github.com/platformio/platformio-examples/tree/develop/atmelavr/wiring-blink>`_
+* `Arduino with external libraries <https://github.com/platformio/platformio-examples/tree/develop/atmelavr/arduino-external-libs>`_
+* `Arduino with internal libraries <https://github.com/platformio/platformio-examples/tree/develop/atmelavr/arduino-internal-libs>`_
+* `Project uses source file name for "src" directory (Arduino project structure) <https://github.com/platformio/platformio-examples/tree/develop/atmelavr/arduino-own-src_dir>`_
+* `Atmel AVR Native blink <https://github.com/platformio/platformio-examples/tree/develop/atmelavr/atmelavr-native-blink>`_
+* `Digitstump Mouse <https://github.com/platformio/platformio-examples/tree/develop/atmelavr/digitstump-mouse>`_
+* `Engduino magnetometer <https://github.com/platformio/platformio-examples/tree/develop/atmelavr/engduino-magnetometer>`_

Providing examples for OTA firmware updates without authentication is dangerous and irresponsible.

Looking at this (https://github.com/platformio/platformio-examples/tree/develop/espressif/esp8266-arduino-ota), there appears to be absolutely no password or authentication required to remotely reflash the device at all!

This is extremely irresponsible and the type of thing that leads to criminal botnets etc. Many developers will copy and paste the code as is. Safe use of the function should be demonstrated (including unique, non-default passwords), or no demonstration should be provided at all.

Note even the upstream OTA library setPassword implementation uses an unsalted, single pass of the vulnerable and deprecated MD5 algorithm to store passwords, rather than a password hashing function. Amongst other issues (including a repeating, timer based nonce). But at least is very slightly better than having absolutely no security at all.

Please find and use a suitable implementation. (I'd recommend https://github.com/jedisct1/libhydrogen/, but it's still a work in progress).

To learn more about IoT security, please see the following resources:

Hinden, B., March 2017, "The Internet of Insecure Things", The Internet Protocol Journal, Vol.20, No. 1, p.12, ISSN 1944-1134, accessed 10 April 2017, http://ipj.dreamhosters.com/wp-content/uploads/issues/2017/ipj20-1.pdf

IETF Internet Architecture Board, 2017, "Report from the Internet of Things (IoT) Software Update (IoTSU) Workshop 2016", draft-iab-iotsu-workshop-01, https://datatracker.ietf.org/doc/draft-iab-iotsu-workshop/?include_text=1

IoT Security Foundation, 2016, “IoT Security Compliance Framework”, Release 1, accessed 9 April 2017, https://iotsecurityfoundation.org/wp-content/uploads/2016/12/IoT-Security-Compliance-Framework.pdf

Cloud Security Alliance, 2016, “Future-proofing the Connected World: 13 Steps to Developing Secure IoT Products”, accessed 9 April 2017, https://downloads.cloudsecurityalliance.org/assets/research/internet-of-things/future-proofing-the-connected-world.pdf

U.S. Department of Homeland Security, 2016, "Strategic Principles for Securing the Internet of Things (IoT)", Version 1.0, https://www.dhs.gov/sites/default/files/publications/Strategic_Principles_for_Securing_the_Internet_of_Things-2016-1115-FINAL_v2-dg11.pdf

U.S. National Institute of Standards and Technology, 2014, "Framework for Improving Critical Infrastructure Cybersecurity", Version 1.0, https://www.nist.gov/sites/default/files/documents/cyberframework/cybersecurity-framework-021214.pdf

Industrial Internet Consortium, 2016, “Industrial Internet of Things Volume G4: Security Framework”, accessed 9 April 2017, http://www.iiconsortium.org/pdf/IIC_PUB_G4_V1.00_PB-3.pdf

Online Trust Alliance, 2017, “IoT Trust Framework”, accessed 9 April 2017, http://otalliance.actonsoftware.com/acton/attachment/6361/f-008d/1/-/-/-/-/IoT%20Trust%20Framework.pdf

To learn more about WHY you should securing systems, see examples like these:

Krebs, B., 2012, “The Scrap Value of a Hacked PC, Revisited”, Krebs On Security blog, accessed 9 April 2017, https://krebsonsecurity.com/2012/10/the-scrap-value-of-a-hacked-pc-revisited/

Neumann, P., 2015, Illustrative Risks to the Public in the Use of Computer Systems and Related Technology, Computer Science Laboratory, SRI International, Menlo Park CA, accessed 9 April 2017, http://www.csl.sri.com/users/neumann/illustrative.html

https://en.wikipedia.org/wiki/2016_Dyn_cyberattack#Affected_services


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.