GithubHelp home page GithubHelp logo

fprime-community / fprime-arduino Goto Github PK

View Code? Open in Web Editor NEW
24.0 24.0 11.0 359 KB

An implementation allowing fprime to be run on a limite number of Arduino compatible devices.

License: Apache License 2.0

CMake 16.94% C++ 81.12% C 0.68% Shell 0.18% Fortran 1.09%

fprime-arduino's People

Contributors

ethancheez avatar lestarch avatar lukeclements avatar sterlingpeet avatar thomas-bc 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

fprime-arduino's Issues

update cross compile toolchain installation instructions in README

The cross compile toolchain for Teensyduino seems to be expecting arduino-1.8.13 to be installed in /opt as well as arm-none-eabi-gcc to be installed in /opt/arduino-1.8.13/hardware/tools/arm/bin/.

For example, I'm currently running into the following error, after installing arduino in the expected folder.

CMake Error at CMakeLists.txt:17 (project):
  The CMAKE_C_COMPILER:

    /opt/arduino-1.8.13/hardware/tools/arm/bin/arm-none-eabi-gcc

  is not a full path to an existing compiler tool.

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.


CMake Error at CMakeLists.txt:17 (project):
-- Configuring incomplete, errors occurred!
  The CMAKE_CXX_COMPILER:
See also "/home/kasm-user/fprime-arduino/build-fprime-automatic-Teensyduino/CMakeFiles/CMakeOutput.log".

See also "/home/kasm-user/fprime-arduino/build-fprime-automatic-Teensyduino/CMakeFiles/CMakeError.log".
    /opt/arduino-1.8.13/hardware/tools/arm/bin/arm-none-eabi-g++

  is not a full path to an existing compiler tool.

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.


[ERROR] CMake erred with return code 1. Partial build cache remains. Run purge to clean-up.

Implementing SD Card as Os::File

Add support for a file system on Arduino platforms, using an SD card.

See these additions:

@LeStarch I would like your expertise/opinion on this. Do you think this is worth adding? Or is work being done to implement a microFS within FPrime that would perform better (or make more sense) compared to an SD card instance?

Edit: An argument to use an SD card over a microFS is memory usage. External storage means the file system would not have to tap into the internal FLASH/RAM, which is already very limited for most Arduino platforms

So far I have done small tests with this and was able to read/write multiple files, create directories, delete files, move files etc.

A possible design flaw with this is that I had to use new ::File within the constructor and store the Arduino File class as a pointer to m_fd.

Adding this new feature will hopefully allow the integrating of FileUplink and FileDownlink for Baremetal applications.
Edit: FileDownlink and Uplink works

Generate not working for RP2040

Hello,

I've been trying to run the arduino led blinker tutorial on the RP2040. https://fprime-community.github.io/fprime-tutorial-arduino-blinker/

I'm getting stuck on the first fprime-util generate. I'm getting the error shown below

[INFO] Generating build directory at: /Users/your-user/led-blinker/build-fprime-automatic-rpipicow
[INFO] Using toolchain file /Users/your-user/led-blinker/fprime-arduino/cmake/toolchain/rpipicow.cmake for platform default
Traceback (most recent call last):
  File "/Users/your-user/fprime-venv/bin/arduino-cli-wrapper", line 5, in <module>
    from arduino_cli_cmake_wrapper.cli import main
  File "/Users/your-user/fprime-venv/lib/python3.8/site-packages/arduino_cli_cmake_wrapper/cli.py", line 193, in <module>
    def assemble_output_data(test_files: dict[Source, Path], stages: Dict[Stage, List[str]], detect: bool, include: bool, post_link: bool) -> Tuple[Dict, Path]:
TypeError: 'type' object is not subscriptable
CMake Error at fprime-arduino/cmake/toolchain/support/arduino-wrapper.cmake:72 (message):
  Could not run 'arduino-cli' please install 'arduino-cli' and board
  'rp2040:rp2040:rpipicow'.
Call Stack (most recent call first):
  fprime-arduino/cmake/toolchain/support/arduino-support.cmake:43 (run_arduino_wrapper)
  fprime-arduino/cmake/toolchain/support/arduino-support.cmake:201 (set_arduino_build_settings)
  fprime-arduino/cmake/toolchain/rpipicow.cmake:19 (include)
  /usr/local/Cellar/cmake/3.29.0/share/cmake/Modules/CMakeDetermineSystem.cmake:146 (include)
  CMakeLists.txt:7 (project)


CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
-- Configuring incomplete, errors occurred!
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage

Here's my settings.ini file

[fprime]
project_root: .
framework_path: ./fprime

default_cmake_options:  FPRIME_ENABLE_FRAMEWORK_UTS=OFF
                        FPRIME_ENABLE_AUTOCODER_UTS=OFF
library_locations: ./fprime-arduino
default_toolchain: rpipicow
deployment_cookiecutter: https://github.com/fprime-community/fprime-arduino-deployment-cookiecutter.git

Some observations:

  • I can build Ref in fprime, so I don't think it's my build system
  • I've tried updating the fprime build tools pip install -U fprime-tools

Any ideas? Let me know if you need any more information

fprime-util install fails for libSvc_LinuxTime

Issue

I'm able to successfully fprime-util generate and fprime-util build the application. When I attempt to run fprime-util install I get the following CMake error:

CMake Error at F-Prime/Svc/LinuxTime/cmake_install.cmake:36 (file):
  file INSTALL cannot find
  "/home/dev/oosfprime/fprime-arduino/ArduinoBlink/build-fprime-automatic-Teensyduino/lib/Teensyduino/libSvc_LinuxTime.a":
  No such file or directory.
Call Stack (most recent call first):
  F-Prime/Svc/cmake_install.cmake:60 (include)
  cmake_install.cmake:39 (include)

Workaround

I have a work around to go into the fprime/Svc/CmakeLists.txt and fprime/Drv/CmakeLists.txt and comment out the offending components like so:

# in fprime/Svc/CmakeLists.txt
...
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/GroundInterface/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Health/")
# add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LinuxTime/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LinuxTimer/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/PassiveConsoleTextLogger/")
...
# in fprime/Drv/CmakeLists.txt
...
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LinuxSpiDriver/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LinuxI2cDriver/")
# add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/SocketIpDriver/")

Then the application builds as expected.

More Info

Upon closer inspection, this is the first of two fprime libraries excluded by the application in fprime-arduino.cmake

set_target_properties(
    Svc_LinuxTime
    Drv_SocketIpDriver
    PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1)

It appears the target propery is being correctly set and the static libraries are in fact properly excluded from the build. However, the install step is still looking for the library and is not properly excluded from the build so to speak.

The fprime-util generate step invokes the generate_library CMake macro (defined in cmake/support/Module.cmake)

function(generate_library MODULE_NAME SOURCE_FILES_INPUT DEPS_INPUT)
  # ... (code omitted)
  # Install the executable, if not excluded and not testing
  get_target_property(IS_EXCLUDE_FROM_ALL "${MODULE_NAME}" "EXCLUDE_FROM_ALL")
  if ("${IS_EXCLUDE_FROM_ALL}" STREQUAL "IS_EXCLUDE_FROM_ALL-NOTFOUND" AND
      NOT CMAKE_BUILD_TYPE STREQUAL "TESTING") 
      install(TARGETS "${MODULE_NAME}"
          RUNTIME DESTINATION "bin/${PLATFORM}"
          LIBRARY DESTINATION "lib/${PLATFORM}"
          ARCHIVE DESTINATION "lib/static/${PLATFORM}"
      )
  endif()
  # ... (code omitted)
endfunction(generate_library)

But the target property cannot be set before invoking this support macro since it does not yet exist.

I imagine with the new out-of-source build in Fprime 1.5.1 that a proper solution would be to not modify the source fprime code in any way. Perhaps there could be a new fprime_* macro that could be used to properly exclude default Svc and Drv components or perhaps the execution order of the fprime-util could be modified so the the install logic checking for the EXCLUDE_FROM_ALL property would occur after the application had a chance to set that property (likely in a second pass after the generate_library macro is called.)

Great work on the out-of-source build and user documentation! Great work!

`Failed to run prescan` encountered while attempting to build ArduinoBlink with `fprime-util build`

F´ Version v3.1.1
Affected Component LedBlinker

Problem Description

Encountered following CMake errors while attempting to build ArduinoBlink app

CMake Error at /home/kasm-user/fprime-arduino/fprime/cmake/prescan.cmake:91 (message):
-- Configuring incomplete, errors occurred!
  Failed to run prescan, cannot continue.
See also "/home/kasm-user/fprime-arduino/ArduinoBlink/build-fprime-automatic-Teensyduino/CMakeFiles/CMakeOutput.log".
Call Stack (most recent call first):
See also "/home/kasm-user/fprime-arduino/ArduinoBlink/build-fprime-automatic-Teensyduino/CMakeFiles/CMakeError.log".
  /home/kasm-user/fprime-arduino/fprime/cmake/FPrime.cmake:68 (perform_prescan)
  CMakeLists.txt:23 (include)


[ERROR] CMake erred with return code 1. Partial build cache remains. Run purge to clean-up.

How to Reproduce

( optional: locally build and run virtual environment tools from https://github.com/capsulecorplab/kasm-fprime-workspace/tree/install-cross-compile-toolchain-for-teensy)

  1. clone and checkout capsulecorplab@9bc4185
  2. attempt to build using fprime-util build from ArduinoBlink directory

Expected Behavior

Should build without CMake errors.

CMake error [No SOURCES given to target: teensycore] while attempting to generate build cache directory

Encountered following CMake error while attempting to generate build cache directory with fprime-util generate Teensyduino

CMake Error at cmake/toolchain/Teensyduino.cmake:95 (add_library):
  No SOURCES given to target: teensycore
Call Stack (most recent call first):
  fprime-arduino/ArduinoOs/CMakeLists.txt:76 (add_arduino_dependency)


CMake Generate step failed.  Build files cannot be regenerated correctly.
[ERROR] CMake erred with return code 1. Partial build cache remains. Run purge to clean-up.

CMake Error - The dependency target "Svc_Time" of target "Arduino_ArduinoTime" does not exists.

After the Fprime v3.4.0 the arduino lib failed to generate for all boards.
See: Convert Svc.Time into An Interface by @LeStarch

I think it may be due to the changes in Svc/Time.
This is the Error

CMake Error at fprime/cmake/target/build.cmake:83 (add_dependencies):
--Generating done
The dependency target "Svc_Time" of target "Arduino_ArduinoTime" does
not exists.
Call Stack (most recent call first):
fprime/cmake/target/build.cmake:141 (build_setup_build_module)
fprime/cmake/target/target.cmake:116 (build_add_module_target)
fprime/cmake/target/target.cmake:116 (cmake_language)
fprime/cmake/target/target.cmake:155 (setup_single_target)
fprime/cmake/module.cmake:48 (setup_single_target)
fprime/cmake/module.cmake:88 (generate_base_module_properties)
fprime/cmake/API.cmake:228 (generate_library)
fprime-arduino/Arduino/ArduinoTime/CMakeLists.txt:19 (register_fprime_module)

Steps to recreate:
Start a fresh venv and follow the arduino tutorial in the fprime website
follow the arduino cli guide for any board, add fprime-arduino as a lib, and then fprime-util generate.

How to install on Arduino?

Fprime Commit 20b5f29

Question About Installation

I was wondering if you could provide further instructions on how to install the project on an Arduino. I have run the fprime-util generate and fprime-util build commands successfully but I'm unsure where and what binaries are needed to run the project on the Arduino.

The commands generate the build-fprime-automatic-Teensyduino folder in which I have found that the lib/Teensyduino folder contains static libraries. Are those the binaries needed to run the project on the Arduino? If so, how does one go about installing it on the microcontroller? Additionally, which pins should I connect the LED to for the project to work?

Thank you!

After Further Inspection

My friend @redknight990 and I were looking around fprime for more examples and came to the realization that we are supposed to most likely run fprime-util generate in the ArduinoBlink folder rather than the root folder in order to generate the binary properly.

This however results in the following error

image

@redknight990 found that the error is most likely on the following line

image

Additionally, we were wondering if this would be able to run on an Arduino Uno.

Thank you once again!

Add library dependencies in the README

Some drivers added to this fprime-arduino package may require you to install libraries through the arduino-cli:

TcpClient:

arduino-cli lib install WiFi

It probably makes more sense to put the arduino-cli install guide in here rather than within each fprime project using this package? That way, a project can link to the README in here and you would only have to manage a single arduino-cli installation guide.

ESP32 generate seems to have broke. Cannot find core.a

Something with the arduino-cli-cmake-wrapper maybe?

$ fprime-util generate esp32
[INFO] Generating build directory at: /home/ethan/work/fprime-projects/fprime-community/fprime-tutorial-arduino-blinker/build-fprime-automatic-esp32
[INFO] Using toolchain file /home/ethan/work/fprime-projects/fprime-community/fprime-tutorial-arduino-blinker/fprime-arduino/cmake/toolchain/esp32.cmake for platform esp32
WARNING:arduino_cli_cmake_wrapper.parser:Unknown sections detected with titles: Creating esp32 image...,Creating esp32 image...
[ERROR] AssertionError occurred. Could not find core.a
Traceback (most recent call last):
  File "/home/ethan/venv/fprime/bin/arduino-cli-wrapper", line 8, in <module>
    sys.exit(main())
  File "/home/ethan/venv/fprime/lib/python3.10/site-packages/arduino_cli_cmake_wrapper/cli.py", line 241, in main
    output_data, cache_path = assemble_output_data(
  File "/home/ethan/venv/fprime/lib/python3.10/site-packages/arduino_cli_cmake_wrapper/cli.py", line 224, in assemble_output_data
    return data, sketch_cache(stages)
  File "/home/ethan/venv/fprime/lib/python3.10/site-packages/arduino_cli_cmake_wrapper/miner.py", line 140, in sketch_cache
    assert core_tokens, "Could not find core.a"
AssertionError: Could not find core.a
CMake Error at fprime-arduino/cmake/toolchain/support/arduino-wrapper.cmake:72 (message):
  Could not run 'arduino-cli' please install 'arduino-cli' and board
  'esp32:esp32:esp32'.
Call Stack (most recent call first):
  fprime-arduino/cmake/toolchain/support/arduino-support.cmake:43 (run_arduino_wrapper)
  fprime-arduino/cmake/toolchain/support/arduino-support.cmake:201 (set_arduino_build_settings)
  fprime-arduino/cmake/toolchain/esp32.cmake:22 (include)
  /usr/share/cmake-3.27/Modules/CMakeDetermineSystem.cmake:148 (include)
  CMakeLists.txt:5 (project)


CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
[ERROR] CMake erred with return code 1. Partial build cache remains. Run purge to clean-up.

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.