Skip to content

Commit

Permalink
Merge pull request #40 from roleroz/fs
Browse files Browse the repository at this point in the history
Having FS flashing as part of programming the microcontroller is slow, and ends up trashing the flash memory without need. As FS flashing is something that happens way less often than programming a microcontroller, now you can use platformio_fs() to flash you FS

bazel build ... and bazel test ... all pass

joso@pop-os:~/git/platformio_rules$ bazel clean --expunge
INFO: Starting clean (this may take a while). Consider using --async if the clean takes more than several minutes.


joso@pop-os:~/git/platformio_rules$ bazel build ...
Starting local Bazel server and connecting to it...
DEBUG: Rule 'io_bazel_stardoc' indicated that a canonical reproducible form can be obtained by modifying arguments commit = "50cb91505b14b1dd07e32eb6145c5767b7a629c7" and dropping ["tag"]
DEBUG: Repository io_bazel_stardoc instantiated at:
  /home/joso/git/platformio_rules/WORKSPACE:25:30: in <toplevel>
  /home/joso/git/platformio_rules/bazel/deps.bzl:10:19: in platformio_rules_dependencies
Repository rule git_repository defined at:
  /home/joso/.cache/bazel/_bazel_joso/e97f26a8b58df374fb064ff4a095894c/external/bazel_tools/tools/build_defs/repo/git.bzl:181:33: in <toplevel>
INFO: Analyzed 29 targets (76 packages loaded, 3906 targets configured).
INFO: Found 29 targets...
INFO: From Action tests/arduino/lib/Arduino_impl/Arduino_impl.h:
/home/joso/.cache/bazel/_bazel_joso/e97f26a8b58df374fb064ff4a095894c/execroot/__main__
INFO: From Action tests/arduino/lib/Arduino_interface/Arduino_interface.h:
/home/joso/.cache/bazel/_bazel_joso/e97f26a8b58df374fb064ff4a095894c/execroot/__main__
INFO: From Action tests/binary_counter/led_display/lib/Led_display/Led_display.h:
/home/joso/.cache/bazel/_bazel_joso/e97f26a8b58df374fb064ff4a095894c/execroot/__main__
INFO: From Action tests/binary_counter/convert/lib/Convert/Convert.h:
/home/joso/.cache/bazel/_bazel_joso/e97f26a8b58df374fb064ff4a095894c/execroot/__main__
INFO: From Action tests/binary_counter/button_presses/lib/Button_presses/Button_presses.h:
/home/joso/.cache/bazel/_bazel_joso/e97f26a8b58df374fb064ff4a095894c/execroot/__main__
INFO: From Action tests/rgb_blink/lib/rgb_led/rgb_led.h:
/home/joso/.cache/bazel/_bazel_joso/e97f26a8b58df374fb064ff4a095894c/execroot/__main__
INFO: From Action tests/rgb_blink/rgb_blink_workdir/.pio/build/esp32-s3-devkitc-1/firmware.elf:
Library Manager: Installing adafruit/Adafruit NeoPixel#1.11.0
Unpacking
Library Manager: Adafruit [email protected] has been installed!
INFO: Elapsed time: 27.781s, Critical Path: 17.99s
INFO: 132 processes: 65 internal, 67 local.
INFO: Build completed successfully, 132 total actions


joso@pop-os:~/git/platformio_rules$ bazel test ...
INFO: Analyzed 29 targets (1 packages loaded, 504 targets configured).
INFO: Found 25 targets and 4 test targets...
INFO: Elapsed time: 1.567s, Critical Path: 1.31s
INFO: 5 processes: 5 local.
INFO: Build completed successfully, 5 total actions
//:requirements_test                                                     PASSED in 1.2s
//tests/binary_counter/button_presses:button_presses_test                PASSED in 0.0s
//tests/binary_counter/convert:convert_test                              PASSED in 0.0s
//tests/binary_counter/led_display:led_display_test                      PASSED in 0.0s

Executed 4 out of 4 tests: 4 tests pass.
There were tests whose specified size is too big. Use the --test_verbose_timeout_warnings command line option to see which ones these are.
  • Loading branch information
mum4k authored Apr 20, 2023
2 parents 069b8eb + 0df36b6 commit 847b051
Show file tree
Hide file tree
Showing 4 changed files with 309 additions and 126 deletions.
43 changes: 41 additions & 2 deletions docs/platformio_doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,46 @@ These are Bazel Starlark rules for building and uploading
[PlatformIO](http://platformio.org/) build system.


<a id="platformio_fs"></a>

## platformio_fs

<pre>
platformio_fs(<a href="#platformio_fs-name">name</a>, <a href="#platformio_fs-board">board</a>, <a href="#platformio_fs-data">data</a>, <a href="#platformio_fs-framework">framework</a>, <a href="#platformio_fs-platform">platform</a>, <a href="#platformio_fs-port">port</a>, <a href="#platformio_fs-programmer">programmer</a>)
</pre>


Defines data that will be uploaded to the microcontroller's filesystem using
PlatformIO.

Creates, configures and runs a PlatformIO project. This is equivalent to running:

```
platformio run
```

This rule is executable and when executed, it will upload the provided data to
the connected Arduino device. This is equivalent to running:

```
platformio run -t uploadfs
```


**ATTRIBUTES**


| Name | Description | Type | Mandatory | Default |
| :------------- | :------------- | :------------- | :------------- | :------------- |
| <a id="platformio_fs-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
| <a id="platformio_fs-board"></a>board | A string, name of the Arduino board to build this project for. You can find the supported boards in the [PlatformIO Embedded Boards Explorer](http://platformio.org/boards). This is mandatory. | String | required | |
| <a id="platformio_fs-data"></a>data | Filegroup containing files to upload to the device's FS memory. | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
| <a id="platformio_fs-framework"></a>framework | A string, the name of the [framework]( http://docs.platformio.org/en/latest/frameworks/index.html#frameworks) for this project. | String | optional | <code>"arduino"</code> |
| <a id="platformio_fs-platform"></a>platform | A string, the name of the [development platform]( http://docs.platformio.org/en/latest/platforms/index.html#platforms) for this project. | String | optional | <code>"atmelavr"</code> |
| <a id="platformio_fs-port"></a>port | Port where your microcontroller is connected. This field is mandatory if you are using arduino_as_isp as your programmer. | String | optional | <code>""</code> |
| <a id="platformio_fs-programmer"></a>programmer | Type of programmer to use: - direct: Use the USB connection in the microcontroller deveopment board to program it - arduino_as_isp: Use an arduino programmed with the Arduino as ISP code to in-circuit program another microcontroller (see https://docs.arduino.cc/built-in-examples/arduino-isp/ArduinoISP for details). - usbtinyisp: Use an USBTinyISP programmer, like https://www.amazon.com/gp/product/B09DG384MK | String | optional | <code>"direct"</code> |


<a id="platformio_library"></a>

## platformio_library
Expand Down Expand Up @@ -79,7 +119,7 @@ expected by PlatformIO.

<pre>
platformio_project(<a href="#platformio_project-name">name</a>, <a href="#platformio_project-board">board</a>, <a href="#platformio_project-build_flags">build_flags</a>, <a href="#platformio_project-deps">deps</a>, <a href="#platformio_project-environment_kwargs">environment_kwargs</a>, <a href="#platformio_project-framework">framework</a>, <a href="#platformio_project-lib_deps">lib_deps</a>,
<a href="#platformio_project-lib_ldf_mode">lib_ldf_mode</a>, <a href="#platformio_project-platform">platform</a>, <a href="#platformio_project-port">port</a>, <a href="#platformio_project-programmer">programmer</a>, <a href="#platformio_project-src">src</a>, <a href="#platformio_project-upload_fs">upload_fs</a>)
<a href="#platformio_project-lib_ldf_mode">lib_ldf_mode</a>, <a href="#platformio_project-platform">platform</a>, <a href="#platformio_project-port">port</a>, <a href="#platformio_project-programmer">programmer</a>, <a href="#platformio_project-src">src</a>)
</pre>


Expand Down Expand Up @@ -121,7 +161,6 @@ uploading.
| <a id="platformio_project-port"></a>port | Port where your microcontroller is connected. This field is mandatory if you are using arduino_as_isp as your programmer. | String | optional | <code>""</code> |
| <a id="platformio_project-programmer"></a>programmer | Type of programmer to use: - direct: Use the USB connection in the microcontroller deveopment board to program it - arduino_as_isp: Use an arduino programmed with the Arduino as ISP code to in-circuit program another microcontroller (see https://docs.arduino.cc/built-in-examples/arduino-isp/ArduinoISP for details). - usbtinyisp: Use an USBTinyISP programmer, like https://www.amazon.com/gp/product/B09DG384MK | String | optional | <code>"direct"</code> |
| <a id="platformio_project-src"></a>src | A string, the name of the C++ source file, the main file for the project that contains the Arduino setup() and loop() functions. This is mandatory. | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
| <a id="platformio_project-upload_fs"></a>upload_fs | Filegroup containing files to upload to the device's FS memory. | <a href="https://bazel.build/concepts/labels">Label</a> | optional | <code>None</code> |


<a id="PlatformIOLibraryInfo"></a>
Expand Down
Loading

0 comments on commit 847b051

Please sign in to comment.