Skip to content
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

Large Teensy 3.1 project build broken with large const data, works when built with Arduino/Teensyduino #626

Closed
blackketter opened this issue Apr 20, 2016 · 7 comments
Assignees

Comments

@blackketter
Copy link

blackketter commented Apr 20, 2016


Configuration

Operating system:
MacOS X 10.11.4
Arduino 1.6.8, Teensyduino 1.28

PlatformIO Version (platformio --version):
2.8.6

Description of problem

Large Teensy project builds but does not run correctly (some errors with i2c, etc.) when a largish constant data structure gets too big.

Builds and runs correctly under Arduino/Teensyduino

If problems with PlatformIO Build System:

The content of platformio.ini:

[env:teensy31]
lib-ignore = extras
platform = teensy
framework = arduino
board = teensy31
build_flags = -DTEENSY31 -UUSB_SERIAL -DTEENSYDUINO=127 -DARDUINO_ARCH_AVR -DUSB_SERIAL_HID -DLAYOUT_US_ENGLISH -I./src
board_f_cpu = 96000000

Source file to reproduce issue:
It's a large project. The problem goes away when I reduce the size of one large const data structure from about 6k to 2k. Happy to provide the full source if necessary.

Attached are the elf files and build logs for arduino and platformio

Additional info

arduino.buildresults.txt
firmware.elfs.zip
platformio.buildresults.txt

@valeros
Copy link
Member

valeros commented Apr 21, 2016

Hi @blackketter !
Could you provide an entire project, please? It would be easier to debug.
Thanks!

@blackketter
Copy link
Author

Thanks, @valeros!

To make things easier, I pushed the project to github:

https://github.com/blackketter/britepad.git

Use the platformio-broken branch to build with the large data structure, "keyConfig" in src/apps/CalculatorApp.cpp

The master branch has this file removed from the build, for now.

Let me know if there's anything I can do to help.

@valeros
Copy link
Member

valeros commented Apr 22, 2016

Could you please try in turn these two variants:

  1. Disable optimization, build_flags = -O ..other flags
  2. Try latest arduinoteensy package from here (just replace older version in PlatformIO home directory)

@blackketter
Copy link
Author

blackketter commented Apr 22, 2016

Aha! -O seems to fix the issue, though I'm not sure what other side effects there might be.

It did increase the firmware size from 195032 to 212096.

@ivankravets ivankravets added this to the 2.9.0 milestone Apr 26, 2016
@valeros
Copy link
Member

valeros commented Apr 28, 2016

Hi @blackketter! Any news about your problem? Did -O optimization help?
I've just updated teensy framework to 1.28 version, so you can try it via pio update

@blackketter
Copy link
Author

Sorry, I wasn't clear. -O did fix the problem. It also increased the firmware image size, but that's the only side effect I noticed. Looking back at the regular Arduino/Teensyduino build output, it did use -O as the optimization level, so I think this is the correct solution and should probably be the default optimization level.

@ivankravets
Copy link
Member

Could we close this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants