Coder Social home page Coder Social logo

platformio / platform-native Goto Github PK

View Code? Open in Web Editor NEW
19.0 4.0 23.0 36 KB

Native: development platform for PlatformIO

Home Page: https://registry.platformio.org/platforms/platformio/native

License: Apache License 2.0

Python 100.00%
platformio platformio-platform

platform-native's Introduction

PlatformIO Core

CI Build for PlatformIO Core

CI Build for Docs

CI Build for dev-platform examples

CI Build for the Community Projects

Latest Version

PlatformIO Labs

Quick Links: Homepage | PlatformIO IDE | Registry | Project Examples | Docs | Donate | Contact Us

Social: LinkedIn | Twitter | Facebook | Community Forums

image

PlatformIO: Your Gateway to Embedded Software Development Excellence.

Unlock the true potential of embedded software development with PlatformIO's collaborative ecosystem, embracing declarative principles, test-driven methodologies, and modern toolchains for unrivaled success.

  • Open source, maximum permissive Apache 2.0 license
  • Cross-platform IDE and Unified Debugger
  • Static Code Analyzer and Remote Unit Testing
  • Multi-platform and Multi-architecture Build System
  • Firmware File Explorer and Memory Inspection

Get Started

Solutions

Advanced

Registry

Contributing

See contributing guidelines.

Telemetry / Privacy Policy

Share minimal diagnostics and usage information to help us make PlatformIO better. It is enabled by default. For more information see:

License

Copyright (c) 2014-present PlatformIO <[email protected]>

The PlatformIO is licensed under the permissive Apache 2.0 license, so you can use it in both commercial and personal projects with confidence.

SWUbanner

platform-native's People

Contributors

ivankravets avatar valeros avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

platform-native's Issues

Different compiler

I'd like to invoke emcc/em++ (Emscripten) instead of GCC during native compilation. I cannot figure out how to do that.

One possible solution should be to have an argument forwarding script named gcc and prepend PATH with it. This would call emcc. What would be a cleaner solution?

Feature Request: native development on macOS using clang and lldb

Feature request

As far as I am aware PlatformIO only supports native development on macOS using gcc and gdb. This is problematic. First, because installing gdb on Intel based macs is not straightforward because of the need to code-sign the application, but secondly and more importantly, because gdb is not even supported on M1/M2 macs and apparently (link) won’t be in the near future.

Being able to code, test and debug natively greatly speeds up development. It would therefore be great if support were available to compile and debug code using macOS’s compiler (clang) and debugger (lldb). Would it be possible to provide that support?

Unit Test Build Error in PlatformIO, Windows 10. Error: 'g++' is not recognized as an internal or external command

I have an issue running unit test cases in platformIO using VS code in Windows 10 PC.
It throws the below error in the platformIO powershell.
"
Building...
'g++' is not recognized as an internal or external command,
operable program or batch file. ....
"
When I type "g++ --version" here, it doesn't detect g++.

On the other hand, I can access g++ from the windows command line. It seems a problem with the PIO powershell only. I have already setup the path for minGW64 bin folder under the Windows system variables.
Can someone help to run the test cases, please?

Below is the platformio.ini configuration for the unit test native environment:

[env:unit-test-native]
platform = native
framework =
build_flags =
-std=gnu++17
-Wall
-D LITTLE_ENDIAN
-D UNIT_TEST
-D __STDC_FORMAT_MACROS
test_build_project_src = true
lib_ignore =
extra_scripts =


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

UnicodeDecodeError on Windows 10 Native project

Hi
I tried to build a Native project but ran into errors with the builder system.

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xdd in position 0: invalid continuation byte: File "C:\Users\anikin_md\.platformio\penv\lib\site-packages\platformio\builder\main.py", line 170: env.SConscript("$BUILD_SCRIPT") File "C:\Users\anikin_md\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 598: return _SConscript(self.fs, *files, **subst_kw) File "C:\Users\anikin_md\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 287: exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals) File "C:\Users\anikin_md\.platformio\platforms\native\builder\main.py", line 33: env.Tool("gcc") File "C:\Users\anikin_md\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py", line 1844: tool(self) File "C:\Users\anikin_md\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Tool\__init__.py", line 269: self.generate(env, *args, **kw) File "C:\Users\anikin_md\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Tool\gcc.py", line 59: version = detect_version(env, env['CC']) File "C:\Users\anikin_md\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Tool\gcc.py", line 94: while SCons.Util.to_str(pipe.stdout.readline()): File "C:\Users\anikin_md\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Util.py", line 1602: return str(s, 'utf-8')

My system:
Windows 10 x64
Python 3.8.5 (If PIO uses already installed python)
VSCode 1.52.0
PIO Core 5.0.3

Other platforms (AVR/STM32/Nordic) work great.

Setting CXX flags from extra_script.py doesn't work

I was able to normally build pio test -e native around two-three months ago on version 4.3.2a1.

Then I went back to my project and tried to run the native tests with the same setup, but with no luck. The version I have currently is 4.3.4a2.

Inside extra_script.py:

env.Append(
    CXXFLAGS=[
        '-Wall',
        '-Wextra',
        '-std=gnu++17',
        '-Wno-register'
    ]
)
  1. Tried:
[env]
extra_scripts = pre:extra_script.py
  1. Tried:
[env:native]
extra_scripts = pre:extra_script.py

Both 1. and 2. don't work, but when I change CXXFLAGS to CPPFLAGS the flags are used BUT, both for g++ and gcc.

See the attached logs:

cppflags_defined.log
cxxflags_defined.log

local Libraries and Debugging

Hi,

I just found this, and I think its awesome that I can also compile PlatformIO Projects for Desktop and Linux computers.
Especially for Simulating hardware-independent Code.

I have a view questions:

Library Management:
I copied a library to the "lib" folder but it is not found by the compiler as I would expect it to for other PlatformIO Platforms.
Is there a way to configure the project to automatically include all .h files from the lib folder?

Debugging:
Is there a way to enable step-by-step debugging ? I already have a VSC Project that can debug my c++ files but the setup is very tedious. it would be awesome if debugging would be possible in PIO with native.

I have a feeling the platform-native is still a young project, but I see a lot of potential here!
Thx to the PIO Team! you are doing work that changes how embedded development is done right

“archive has no index” error when unit testing on native with Mingw-w64

With a unit testing project as native test using MinGW64, installed as in the doc, I encountered a
mingw32/bin/ld.exe: .pio\build\native.... .a: error adding symbols: archive has no index; run ranlib to add one
error message.
Via this post I found that MinGW 13.2 seems to be the reason for the problem; after downgrading to MinGW 12.2.0.03042023 solved the issue. (installation via chocolatey; I assume it works also with other installation ways)
Maybe this should be mentioned in the doc.

Library-only project generates an "empty" compile_commands.json

What kind of issue is this?

  • PlatformIO Core.
    If you’ve found a bug, please provide an information below.

Configuration

PlatformIO Version (platformio --version): 5.1.1

Description of problem

Steps to Reproduce

  1. run $ pio run -t compiledb in a library that doesn't generate binaries

Actual Results

  • compile_commands.json contains only []

Expected Results

  • compile_commands.json should I think at least contain info for building the library objects

If problems with PlatformIO Build System:

The content of platformio.ini:

[native]
platform = native
test_transport = native
build_flags = -std=c++17
debug_build_flags = -g -DDEBUG
lib_ldf_mode = deep

[env:release]
extends = native
build_type = release

[env:debug]
extends = native
build_type = debug

Additional info

We have tests that we run natively as this library contains no embedded-specific behavior, just business logic. I would think this would enable generation of a useful compile_commands.json that I can feed to clangd...

g++ not found

For Native Environment - run command outputs:

platformio run
Verbose mode can be enabled via -v, --verbose option
PLATFORM: Native >
SYSTEM:
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(light)
Collected 0 compatible libraries
Scanning dependencies...

No dependencies
Compiling .pioenvs\native\src\main.o
'g++' is not recognized as an internal or external command,
operable program or batch file.
*** [.pioenvs\native\src\main.o] Error 1

It's Windows 7. PlatformIO 3.5.3a7.
In PowerShell console in Atom it also says the same.

While in command prompt g++ is found. Its in path.

Platformio reinstall does not help.

Can you give me a clue where to dig? :)


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

[doc] No board support

The Documentation is a bit confusing. The native platform doesn't support any board but in all examples there is something like this

[env:stable]
platform = native
board = ...
...

Board ... is invalid. In addition, the board configuration must not exist at all. There is nothing, that can be written after board = .

Different compiler

I'd like to invoke emcc/em++ (Emscripten) instead of GCC during native compilation. I cannot figure out how to do that.

One possible solution should be to have an argument forwarding script named gcc and prepend PATH with it. This would call emcc. What would be a cleaner solution?

Note Emscripten wouldn't support symlinking gcc to emcc, I don't think

Can't run on gitlab CI

I'm trying to run my test code on gitlab CI but i'm getting the following error:

Running with gitlab-runner 13.9.0-rc2 (69c049fd)
  on docker-auto-scale 0277ea0f
  feature flags: FF_GITLAB_REGISTRY_HELPER_IMAGE:true
Preparing the "docker+machine" executor
Using Docker executor with image python:3.8.1 ...
Pulling docker image python:3.8.1 ...
Using docker image sha256:efdecc2e377a2438af1cf9e07286b5f7ee3f418c43b4bbb540b3752fdc0e008b for python:3.8.1 with digest python@sha256:7be36bd79ab0d754c2a6db5351b7bf91ebe7161cd0d80a15e47ab2c211a0828b ...
Preparing environment
00:03
Running on runner-0277ea0f-project-12613734-concurrent-0 via runner-0277ea0f-srm-1616087785-3fde39e8...
Getting source from Git repository
00:01
$ eval "$CI_PRE_CLONE_SCRIPT"
Fetching changes...
Initialized empty Git repository in /builds/marfan1/favo-firmware/.git/
Created fresh repository.
Checking out 38e98115 as release/1.13.0...
Skipping Git submodules setup
Executing "step_script" stage of the job script
00:11
Using docker image sha256:efdecc2e377a2438af1cf9e07286b5f7ee3f418c43b4bbb540b3752fdc0e008b for python:3.8.1 with digest python@sha256:7be36bd79ab0d754c2a6db5351b7bf91ebe7161cd0d80a15e47ab2c211a0828b ...
$ pip install --upgrade pip
Collecting pip
  Downloading pip-21.0.1-py3-none-any.whl (1.5 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.0.2
    Uninstalling pip-20.0.2:
      Successfully uninstalled pip-20.0.2
Successfully installed pip-21.0.1
$ pip install -U platformio
Collecting platformio
  Downloading platformio-5.1.1.tar.gz (215 kB)
Collecting bottle==0.12.*
  Downloading bottle-0.12.19-py3-none-any.whl (89 kB)
Collecting click<8,>=5
  Downloading click-7.1.2-py2.py3-none-any.whl (82 kB)
Collecting colorama
  Downloading colorama-0.4.4-py2.py3-none-any.whl (16 kB)
Collecting marshmallow<4,>=2
  Downloading marshmallow-3.10.0-py2.py3-none-any.whl (46 kB)
Collecting pyelftools<1,>=0.27
  Downloading pyelftools-0.27-py2.py3-none-any.whl (151 kB)
Collecting pyserial==3.*
  Downloading pyserial-3.5-py2.py3-none-any.whl (90 kB)
Collecting requests==2.*
  Downloading requests-2.25.1-py2.py3-none-any.whl (61 kB)
Collecting semantic_version==2.8.*
  Downloading semantic_version-2.8.5-py2.py3-none-any.whl (15 kB)
Collecting tabulate==0.8.*
  Downloading tabulate-0.8.9-py3-none-any.whl (25 kB)
Collecting zeroconf==0.28.*
  Downloading zeroconf-0.28.8-py3-none-any.whl (55 kB)
Collecting aiofiles==0.6.*
  Downloading aiofiles-0.6.0-py3-none-any.whl (11 kB)
Collecting ajsonrpc==1.1.*
  Downloading ajsonrpc-1.1.0-py3-none-any.whl (22 kB)
Collecting starlette==0.14.*
  Downloading starlette-0.14.2-py3-none-any.whl (60 kB)
Collecting uvicorn==0.13.*
  Downloading uvicorn-0.13.4-py3-none-any.whl (46 kB)
Collecting wsproto==1.0.*
  Downloading wsproto-1.0.0-py3-none-any.whl (24 kB)
Collecting certifi>=2017.4.17
  Downloading certifi-2020.12.5-py2.py3-none-any.whl (147 kB)
Collecting chardet<5,>=3.0.2
  Downloading chardet-4.0.0-py2.py3-none-any.whl (178 kB)
Collecting urllib3<1.27,>=1.21.1
  Downloading urllib3-1.26.4-py2.py3-none-any.whl (153 kB)
Collecting idna<3,>=2.5
  Downloading idna-2.10-py2.py3-none-any.whl (58 kB)
Collecting h11>=0.8
  Downloading h11-0.12.0-py3-none-any.whl (54 kB)
Collecting ifaddr>=0.1.7
  Downloading ifaddr-0.1.7-py2.py3-none-any.whl (10 kB)
Building wheels for collected packages: platformio
  Building wheel for platformio (setup.py): started
  Building wheel for platformio (setup.py): finished with status 'done'
  Created wheel for platformio: filename=platformio-5.1.1-py3-none-any.whl size=332815 sha256=aba998ed7eee133a65645e3b8bc22502e5c6284efab682e4c9353f522ba8af7a
  Stored in directory: /root/.cache/pip/wheels/2f/63/89/c2dada8b07ccffcb202706137906675e8ae40262183ff173c5
Successfully built platformio
Installing collected packages: urllib3, ifaddr, idna, h11, click, chardet, certifi, zeroconf, wsproto, uvicorn, tabulate, starlette, semantic-version, requests, pyserial, pyelftools, marshmallow, colorama, bottle, ajsonrpc, aiofiles, platformio
Successfully installed aiofiles-0.6.0 ajsonrpc-1.1.0 bottle-0.12.19 certifi-2020.12.5 chardet-4.0.0 click-7.1.2 colorama-0.4.4 h11-0.12.0 idna-2.10 ifaddr-0.1.7 marshmallow-3.10.0 platformio-5.1.1 pyelftools-0.27 pyserial-3.5 requests-2.25.1 semantic-version-2.8.5 starlette-0.14.2 tabulate-0.8.9 urllib3-1.26.4 uvicorn-0.13.4 wsproto-1.0.0 zeroconf-0.28.8
$ pio test -e native
********************************************************************************
If you like PlatformIO, please:
- follow us on Twitter to stay up-to-date on the latest project news > https://twitter.com/PlatformIO_Org
- star it on GitHub > https://github.com/platformio/platformio
- try PlatformIO IDE for embedded development > https://platformio.org/platformio-ide
********************************************************************************
Verbose mode can be enabled via `-v, --verbose` option
Collected 1 items
Processing Native in native environment
--------------------------------------------------------------------------------
Error: Unknown development platform 'native'
Cleaning up file based variables
00:01
ERROR: Job failed: exit code 1

My files:

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; http://docs.platformio.org/page/projectconf.html

[platformio]
default_envs = esp01_1m

[env:esp01_1m]
platform = [email protected]
board = esp01_1m
framework = arduino
build_flags = -Wl,-Tesp8266.flash.1m64.ld -I$PROJECTSRC_DIR
upload_speed = 115200
monitor_speed = 115200
board_build.flash_mode = dout
lib_deps =
  [email protected]
  [email protected]
  [email protected]
  [email protected]
  Adafruit Unified [email protected]
  DHT sensor [email protected]
  paulstoffregen/OneWire @ 2.3.5
  milesburton/DallasTemperature @ 3.9.1

[env:native]
platform = native
image: python:3.8.1

stages:
 - build
 - test

before_script:
  - "pip install --upgrade pip"
  - "pip install -U platformio"

build:
  stage: build
  script: "pio run -e esp01_1m"

test:
  stage: test
  script: "pio test -e native"

A few weeks ago I was able to run. But now it is giving that error.

Can someone help me?

Feature Request: Zephyr + native_posix board

Hello,
It would be great if we could build a zephyr project by selecting native_posix board in platformio.
Does anyone knows the status of this feature?
Is it planned somewhere in near future?

PlatformIO unable to find the board ID native_posix

Hi,

Failing to compile zephyr based application in platformio on native platform, getting below error

> Processing native_posix (platform: native; framework: zephyr; board: native_posix)
> ------------------------------------------------------------------------------------------
> Verbose mode can be enabled via `-v, --verbose` option
> Error: Unknown board ID 'native_posix'

Configuration
Operating system: Windows 10
PlatformIO Core Version: 5.2.4
Compiler : MinGW GCC

Content of platformio.ini

[env:native_posix]
platform = native
framework = zephyr
board = native_posix
test_build_project_src = true

Board information is available at ".platformio\packages\framework-zephyr\boards\posix\native_posix"

Application is compiling successfully on stm32 platform, PIO is able to find the board information at ".platformio\packages\framework-zephyr\boards\arm\nucleo_f429zi".

What could be the reason for not recognizing native_posix board only? what all things need to be taken care other than ini file content and compiler path setting?

Snapshot of c/c++ configuration window:
image

Do not know how to make File target `exec'

I get the following error trying to run pio run --target exec (as described in the docs):

$ ~/platform-native/examples/hello-world$ pio run --target exec
Processing native (platform: native)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
*** Do not know how to make File target `exec' (/home/kluong/platform-native/examples/hello-world/exec).  Stop.
========================================================================== [FAILED] Took 0.27 seconds ==========================================================================

Here is the version I'm using:

$ ~/platform-native/examples/hello-world$ pio --version
PlatformIO Core, version 6.1.4

Building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format

Hi,

I am trying the official example https://github.com/platformio/platformio-examples/tree/develop/unit-testing/calculator

➜  calculator git:(develop) pio test -v -e native
Collected 3 items

Processing test_common in native environment
----------------------------------------------------------------------------------------------------
Building...
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 1 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <calculator> (/Users/lucian/Projects/open/platformio-examples/unit-testing/calculator/lib/calculator)
Building in release mode
g++ -o .pio/build/native/program .pio/build/native/test/test_common/test_calculator.o .pio/build/native/test/tmp_pio_test_transport.o -L.pio/build/native .pio/build/native/lib40d/libcalculator.a .pio/build/native/libUnityTestLib.a
ld: warning: ignoring file .pio/build/native/lib40d/libcalculator.a, building for macOS-x86_64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file .pio/build/native/libUnityTestLib.a, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
Undefined symbols for architecture x86_64:
  "_UnityAssertEqualNumber", referenced from:
      test_function_calculator_addition() in test_calculator.o
      test_function_calculator_subtraction() in test_calculator.o
      test_function_calculator_multiplication() in test_calculator.o
      test_function_calculator_division() in test_calculator.o
  "_UnityBegin", referenced from:
      process() in test_calculator.o
  "_UnityDefaultTestRun", referenced from:
      process() in test_calculator.o
  "_UnityEnd", referenced from:
      process() in test_calculator.o
  "Calculator::add(int, int)", referenced from:
      test_function_calculator_addition() in test_calculator.o
  "Calculator::div(int, int)", referenced from:
      test_function_calculator_division() in test_calculator.o
  "Calculator::mul(int, int)", referenced from:
      test_function_calculator_multiplication() in test_calculator.o
  "Calculator::sub(int, int)", referenced from:
      test_function_calculator_subtraction() in test_calculator.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
*** [.pio/build/native/program] Error 1
==================================== [FAILED] Took 0.63 seconds ====================================

Processing test_desktop in native environment
----------------------------------------------------------------------------------------------------
Building...
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 1 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <calculator> (/Users/lucian/Projects/open/platformio-examples/unit-testing/calculator/lib/calculator)
Building in release mode
g++ -o .pio/build/native/program .pio/build/native/test/test_desktop/test_calculator.o .pio/build/native/test/tmp_pio_test_transport.o -L.pio/build/native .pio/build/native/lib40d/libcalculator.a .pio/build/native/libUnityTestLib.a
ld: warning: ignoring file .pio/build/native/lib40d/libcalculator.a, building for macOS-x86_64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file .pio/build/native/libUnityTestLib.a, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
Undefined symbols for architecture x86_64:
  "_UnityAssertEqualNumber", referenced from:
      test_function_calculator_addition() in test_calculator.o
      test_function_calculator_subtraction() in test_calculator.o
      test_function_calculator_multiplication() in test_calculator.o
      test_function_calculator_division() in test_calculator.o
  "_UnityBegin", referenced from:
      _main in test_calculator.o
  "_UnityDefaultTestRun", referenced from:
      _main in test_calculator.o
  "_UnityEnd", referenced from:
      _main in test_calculator.o
  "Calculator::add(int, int)", referenced from:
      test_function_calculator_addition() in test_calculator.o
  "Calculator::div(int, int)", referenced from:
      test_function_calculator_division() in test_calculator.o
  "Calculator::mul(int, int)", referenced from:
      test_function_calculator_multiplication() in test_calculator.o
  "Calculator::sub(int, int)", referenced from:
      test_function_calculator_subtraction() in test_calculator.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
*** [.pio/build/native/program] Error 1
==================================== [FAILED] Took 0.66 seconds ====================================

Test           Environment    Status    Duration
-------------  -------------  --------  ------------
test_common    uno            IGNORED
test_common    nodemcu        IGNORED
test_common    native         FAILED    00:00:00.631
test_desktop   uno            IGNORED
test_desktop   nodemcu        IGNORED
test_desktop   native         FAILED    00:00:00.660
test_embedded  uno            IGNORED
test_embedded  nodemcu        IGNORED
test_embedded  native         IGNORED
============================== 2 failed, 0 succeeded in 00:00:01.291 ==============================

I'm using macOS Catalina 10.15.7, and my gcc version is:

➜  calculator git:(develop) gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.3 (clang-1103.0.32.62)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Any suggestion is more than welcome. Thank you!

Do not know how to make File target `upload'

MacOS Catalina
CLion 2020.3
PlatformIO Core 5.1.0

When using PlatformIO Upload on a native environment, I eventually get the error in the subject. I can run the command ./.pio/build/native/program manually from the terminal, but would like it to Just Work as if I were uploading to an MCU board.

The following is my native configuration from platformio.ini:


[env:native]
platform = native@^1.1.3
extra_scripts = support/sdl2_build_extra.py
build_flags =
    ${common.build_flags}
    -std=c++17
; Use 32-bits build when possible, for correct memory stat display. You need
; `:i386` sdl2 libs installed. Comment this option for 64-bits build.
;    !python -c "import platform; print('-m32' if platform.system() in [ 'Linux' ] else '')"
; Add recursive dirs for hal headers search
;    !python -c "import os; print(' '.join(['-I {}'.format(i[0].replace('\x5C','/')) for i in os.walk('hal/sdl2')]))"
    -lSDL2
; SDL drivers options
    -D LV_LVGL_H_INCLUDE_SIMPLE
    -D LV_DRV_NO_CONF
    -D USE_MONITOR
    -D MONITOR_ZOOM=2
    -D USE_MOUSE
    -D USE_MOUSEWHEEL
    -D USE_KEYBOARD
lib_deps =
    ${common.lib_deps}
    lv_drivers@~7.9.0
;lv_drivers=https://github.com/littlevgl/lv_drivers/archive/7d71907c1d6b02797d066f50984b866e080ebeed.zip
src_filter =
    ${common.src_filter}
    +<../hal/sdl2>
    -<*/nodemcu32s*>

Some Questions that accumulated

Hi,

I started to integrate the native core into my project a view weeks ago.
in general, i made it to work quite well but i found some rough edged and some stuff that might need fixing.

This is what is found:

1.) Compiler Selection under Windows: Under windows the compiler selection was some work. i found that using "x86_64-12.1.0-release-posix-sjlj-rt_v10-rev3" from mingw-w64 directly downloaded from github works the best. i had problems with compilation not working when using for example cygwin64 and there gcc installation. This could maybe be added to the readme or something like that. this could save people a day or two.

2.) Debugging works in general, but the UI often is no able to read local variables even if they are shown on the top left under local variables
image
when hovering over some variables.

I also get this thread related msg right at the first main() breakpoint
image

3.) Disable of optimization when Debugging does not work
i added "-O0" to my build flags and checked verbose output but variables and functions still get optimized. sometimes that makes step by step debugging impossible

4.) when working with threads debugging is nearly impossible. i use a second thread to check for text input on the cmd window to emulate SerialUSB input from Arduino. Could there be something done with the VSC integration maybe?

Otherwise great stuff! already have the main parts of my microcontroller project running native under windows and linux with file access and everything ;]
I'm thinking about implementing arduino like functionality for the raspberry pi as it has I2C, SPI and Serial as well as GPIOs. i already have the basic delay, millis stuff working very well

Standard out/ printf not flushed

Problem

On Mac OS X/ Ventura the output of printf will only be displayed after the native application has finished.

How to reproduce

Run the following example by running the upload target:

#include <stdio.h>

int main()
{
    printf("Hello World from PlatformIO!\n");
    for (int i = 0; i < 255; i++) {
        printf("I: %d", i);
    }
    while (1) {
        // endless loop
    }
    return 0;
}

Expected: while the program runs there is output on the console
Actual: there is no output of the printf statements

When I run the compiled program directly I get the desired output, so in conclusion the pio run -t exec target must swallow the console output

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.