-
-
Notifications
You must be signed in to change notification settings - Fork 359
Added simple blinky unit test to mbed framework #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
krish2487
wants to merge
4
commits into
platformio:develop
Choose a base branch
from
krish2487:mbed-unittest
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
1f75d89
Added simple blinky unit test to mbed framework
krish2487 99ca0c7
Added explanation to the platformio.ini file regarding the test_port …
krish2487 9e6b091
Added .DS_Store to the .gitignore file.
krish2487 339b0c0
Updated the example to work with STM32F030R8T6 discovery board and ad…
krish2487 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| .pioenvs | ||
| .clang_complete | ||
| .gcc-flags.json | ||
| .piolibdeps | ||
| .DS_Store |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| # Continuous Integration (CI) is the practice, in software | ||
| # engineering, of merging all developer working copies with a shared mainline | ||
| # several times a day < http://docs.platformio.org/en/stable/ci/index.html > | ||
| # | ||
| # Documentation: | ||
| # | ||
| # * Travis CI Embedded Builds with PlatformIO | ||
| # < https://docs.travis-ci.com/user/integration/platformio/ > | ||
| # | ||
| # * PlatformIO integration with Travis CI | ||
| # < http://docs.platformio.org/en/stable/ci/travis.html > | ||
| # | ||
| # * User Guide for `platformio ci` command | ||
| # < http://docs.platformio.org/en/stable/userguide/cmd_ci.html > | ||
| # | ||
| # | ||
| # Please choice one of the following templates (proposed below) and uncomment | ||
| # it (remove "# " before each line) or use own configuration according to the | ||
| # Travis CI documentation (see above). | ||
| # | ||
|
|
||
|
|
||
| # | ||
| # Template #1: General project. Test it using existing `platformio.ini`. | ||
| # | ||
|
|
||
| # language: python | ||
| # python: | ||
| # - "2.7" | ||
| # | ||
| # sudo: false | ||
| # cache: | ||
| # directories: | ||
| # - "~/.platformio" | ||
| # | ||
| # install: | ||
| # - pip install -U platformio | ||
| # | ||
| # script: | ||
| # - platformio run | ||
|
|
||
|
|
||
| # | ||
| # Template #2: The project is intended to by used as a library with examples | ||
| # | ||
|
|
||
| # language: python | ||
| # python: | ||
| # - "2.7" | ||
| # | ||
| # sudo: false | ||
| # cache: | ||
| # directories: | ||
| # - "~/.platformio" | ||
| # | ||
| # env: | ||
| # - PLATFORMIO_CI_SRC=path/to/test/file.c | ||
| # - PLATFORMIO_CI_SRC=examples/file.ino | ||
| # - PLATFORMIO_CI_SRC=path/to/test/directory | ||
| # | ||
| # install: | ||
| # - pip install -U platformio | ||
| # | ||
| # script: | ||
| # - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
|
|
||
| This directory is intended for the project specific (private) libraries. | ||
| PlatformIO will compile them to static libraries and link to executable file. | ||
|
|
||
| The source code of each library should be placed in separate directory, like | ||
| "lib/private_lib/[here are source files]". | ||
|
|
||
| For example, see how can be organized `Foo` and `Bar` libraries: | ||
|
|
||
| |--lib | ||
| | |--Bar | ||
| | | |--docs | ||
| | | |--examples | ||
| | | |--src | ||
| | | |- Bar.c | ||
| | | |- Bar.h | ||
| | |--Foo | ||
| | | |- Foo.c | ||
| | | |- Foo.h | ||
| | |- readme.txt --> THIS FILE | ||
| |- platformio.ini | ||
| |--src | ||
| |- main.c | ||
|
|
||
| Then in `src/main.c` you should use: | ||
|
|
||
| #include <Foo.h> | ||
| #include <Bar.h> | ||
|
|
||
| // rest H/C/CPP code | ||
|
|
||
| PlatformIO will find your libraries automatically, configure preprocessor's | ||
| include paths and build them. | ||
|
|
||
| More information about PlatformIO Library Dependency Finder | ||
| - http://docs.platformio.org/en/stable/librarymanager/ldf.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # ; PlatformIO Project Configuration File | ||
| # ; | ||
| # ; Build options: build flags, source filter, extra scripting | ||
| # ; Upload options: custom port, speed and extra flags | ||
| # ; Library options: dependencies, extra library storages | ||
| # ; | ||
| # ; Please visit documentation for the other options and examples | ||
| # ; http://docs.platformio.org/en/stable/projectconf.html | ||
|
|
||
| [env:bluepill_f103c8] | ||
| platform = ststm32 | ||
| board = bluepill_f103c8 | ||
| framework = mbed | ||
| upload_protocol = gdb | ||
| #This is the built in Serial passthrough for the Blackmagic Probe | ||
| test_port = /dev/cu.usbmodemBFDEA5F3 | ||
| build_flags = -DSTM32F1 | ||
|
|
||
| [env:nucleo_f030r8] | ||
| platform = ststm32 | ||
| board = nucleo_f030r8 | ||
| framework = mbed | ||
| upload_protocol = stlink | ||
| build_flags = -DSTM32F0 | ||
| #This is a FT232 USB Serial Converter | ||
| test_port = /dev/cu.usbserial-A900ZD1K | ||
|
|
||
| #Run "pio device list" to get a list of available serial ports | ||
| #in the system. Connect the TX,RX to the RX,TX of USART1 in the target | ||
|
|
||
| #The build flags are specified to allow for conditional compilation | ||
| #of the program to allow for differences between different dev boards | ||
|
|
||
| #The STM32F030R8 discovery uses the Nucleo F030R8 template and | ||
| #specifies "stlink" as the upload protocol, removing the need for | ||
| #any external programmer | ||
|
|
||
| #Also need to correct the correct clock source and frequency | ||
| #in the STM32F030R8 discovery board. The program functions | ||
| #but blinks much faster than the specified 1 second delay | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| #include "mbed.h" | ||
|
|
||
| #ifndef UNIT_TEST | ||
|
|
||
| /*The leds are connected to different port pins on the | ||
| bluepill F103C8 and Disco F030R8 boards | ||
| */ | ||
|
|
||
| #ifdef STM32F1 | ||
| DigitalOut myled(PC_13); | ||
| #endif | ||
| #ifdef STM32F0 | ||
| DigitalOut myled(PC_9); | ||
| #endif | ||
|
|
||
| int main(void) | ||
| { | ||
| while (1) { | ||
| myled = 1; | ||
| wait(1); | ||
| myled = 0; | ||
| wait(1); | ||
| } | ||
| } | ||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| #include "mbed.h" | ||
| #include "unity.h" | ||
|
|
||
| #ifdef UNIT_TEST | ||
|
|
||
| #ifdef STM32F1 | ||
| DigitalOut myled(PC_13); | ||
| #endif | ||
| #ifdef STM32F0 | ||
| DigitalOut myled(PC_9); | ||
| #endif | ||
|
|
||
|
|
||
| void test_led_write_high(void) | ||
| { | ||
| myled.write(1); | ||
| TEST_ASSERT_EQUAL(myled.read(), 1); | ||
| } | ||
|
|
||
| void test_led_write_low(void) | ||
| { | ||
| myled.write(0); | ||
| TEST_ASSERT_EQUAL(myled.read(), 0); | ||
| } | ||
|
|
||
| int main(void) | ||
| { | ||
| UNITY_BEGIN(); | ||
|
|
||
| wait(1); | ||
| // Without the above delay, the console does not print the PASS/FAIL message | ||
| // for the first couple of unit tests | ||
| RUN_TEST(test_led_write_high); | ||
| wait(0.5); | ||
| RUN_TEST(test_led_write_low); | ||
| wait(0.5); | ||
| UNITY_END(); | ||
| } | ||
|
|
||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| target extended-remote /dev/cu.usbmodemBFDEA5F1 | ||
| monitor swdp_scan | ||
| attach 1 | ||
| load | ||
| quit | ||
| yes |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What to do with this port? I'm not sure that each bluepill_f103c8 board has "2 Serial Ports"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ll comment about the test_port and push again.
and explain about the st-link