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

LDFlags #11

Open
dderiso opened this issue Mar 16, 2016 · 0 comments
Open

LDFlags #11

dderiso opened this issue Mar 16, 2016 · 0 comments

Comments

@dderiso
Copy link

dderiso commented Mar 16, 2016

Great project, thanks!

When enabling arduino (ie setting ARDUINO = 10600), make sure the LDFlags have rtc_localtime set (see line 73 of https://github.com/PaulStoffregen/cores/blob/master/teensy3/Makefile
);

# linker options
LDFLAGS = -Os -Wl,--gc-sections,--defsym=__rtc_localtime=0 --specs=nano.specs -mthumb -mcpu=cortex-m4

This will let the main.cpp work using standard Arduino code, for example:

#include "WProgram.h"

void setup(void){
    pinMode(13, OUTPUT);
}

void loop(void){
    digitalWrite(13, HIGH);
    delay(50);
    digitalWrite(13, LOW);
    delay(50);
}

extern "C" int main(void){
    setup();
    while (1) {
        loop();
        yield();
    }
}

Standard C++ code (thank you so much for this part!) will also work:

#include "WProgram.h"

extern "C" int main(void)
{
    pinMode(13, OUTPUT);
    while (1) {
        digitalWriteFast(13, HIGH);
        delay(50);
        digitalWriteFast(13, LOW);
        delay(50);
    }
}

Also, here are my options (based on yours and PJRC's):

# configurable options
OPTIONS = -DF_CPU=$(TEENSY_CORE_SPEED) -DUSB_SERIAL -DLAYOUT_US_ENGLISH -DUSING_MAKEFILE -ffunction-sections -fdata-sections

# options needed by many Arduino libraries to configure for Teensy 3.0
OPTIONS += -DARDUINO=$(ARDUINO) -DTEENSYDUINO=141

where disabling the bottom line will disable arduino. I like this better than the choice between DUSING_MAKEFILE or arduino, since both (arduino and no arduino) can be built with the makefile. Of course the best part about this is moving away from arduino but using the open source build engine. Thanks again for this!

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

No branches or pull requests

1 participant