Merge pull request #583 from wingunder/move_core_link_last

Moved CORE_LIB to the last position of the defined linked objects.
This commit is contained in:
Sudar Muthu 2018-10-07 11:19:56 +05:30 committed by GitHub
commit 5a0c80bf0c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 117 additions and 1 deletions

View file

@ -1,3 +1,4 @@
sudo: required
language: c
compiler:
- gcc

View file

@ -1610,7 +1610,7 @@ ifeq ($(findstring sam, $(strip $(ARCHITECTURE))), sam)
$(CC) $(LINKER_SCRIPTS) -Wl,-Map=$(OBJDIR)/$(TARGET).map -o $@ $(LOCAL_OBJS) $(OTHER_OBJS) $(OTHER_LIBS) $(LDFLAGS) $(CORE_LIB) -Wl,--end-group
# otherwise traditional
else
$(CC) $(LDFLAGS) -o $@ $(LOCAL_OBJS) $(CORE_LIB) $(OTHER_OBJS) $(OTHER_LIBS) -lc -lm $(LINKER_SCRIPTS)
$(CC) $(LDFLAGS) -o $@ $(LOCAL_OBJS) $(OTHER_OBJS) $(OTHER_LIBS) $(CORE_LIB) -lc -lm $(LINKER_SCRIPTS)
endif
$(CORE_LIB): $(CORE_OBJS) $(LIB_OBJS) $(PLATFORM_LIB_OBJS) $(USER_LIB_OBJS)

View file

@ -5,6 +5,7 @@ The following is the rough list of changes that went into different versions.
I tried to give credit whenever possible. If I have missed anyone, kindly add it to the list.
### In Development
- Fix: Moved CORE_LIB to the last position of the defined linked objects. (https://github.com/wingunder)
- Fix: Moved ATtiny examples to ATtinyBlink, updated alternate core instructions (issue #537) (https://github.com/sej7278)
- Fix: Add -fno-devirtualize flag to workaround g++ segfault bug (issue #486). (https://github.com/sej7278)
- Fix: Quote the prefix tag in the space_pad_to function

View file

@ -0,0 +1,23 @@
// A derived Blink, that uses an example 3rd party library.
// Turns on an LED on for one second, then off for one second, repeatedly.
// This example code is in the public domain.
#include <TogglePin.h>
#ifdef ARDUINO
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#endif // ARDUINO
int main()
{
init();
TogglePin led(13, false);
while (true) {
delay(1000);
led.toggle();
}
}

View file

@ -0,0 +1,24 @@
# This program is free software and is licensed under the same conditions as
# describe in https://github.com/sudar/Arduino-Makefile/blob/master/licence.txt
# This is an example Makefile, that demonstrates the linking of a third party
# library. In this case the third party library resides in the ./Toggle
# sub-directory. Note that the archive TOGGLE_ARCHIVE _only_ contains the
# compiled Toggle.c.o object. The TOGGLE_ARCHIVE is thus very lean, but it
# requires the Arduino libraries, which are being build in this directory,
# together with Blink, the 'main' program.
include board.mk
TOGGLE_ARCHIVE = build-$(BOARD_TAG)/libtoggle.a
CXXFLAGS += -IToggle
OTHER_OBJS = Toggle/$(TOGGLE_ARCHIVE)
include ../../Arduino.mk
Toggle/$(TOGGLE_ARCHIVE):
$(MAKE) -C Toggle $(TOGGLE_ARCHIVE)
clean::
$(MAKE) -C Toggle clean

View file

@ -0,0 +1,14 @@
# This program is free software and is licensed under the same conditions as
# describe in https://github.com/sudar/Arduino-Makefile/blob/master/licence.txt
# This is an example Makefile, that is being used to build an archive
# from locally compiled objects.
#
# All source files in this directory will automatically get compiled
# and archived into the build-$(BOARD_TAG)/libtoggle.a target.
include ../board.mk
include ../../../Arduino.mk
build-$(BOARD_TAG)/libtoggle.a: $(LOCAL_OBJS)
$(AR) rcs $@ $(LOCAL_OBJS)

View file

@ -0,0 +1,27 @@
// This program is free software and is licensed under the same conditions as
// describe in https://github.com/sudar/Arduino-Makefile/blob/master/licence.txt
#include "TogglePin.h"
#ifdef ARDUINO
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#endif // ARDUINO
TogglePin::TogglePin(int pinNumber, bool state)
: _pinNumber(pinNumber), _state(state)
{
pinMode(_pinNumber, OUTPUT);
digitalWrite(_pinNumber, _state ? HIGH : LOW);
}
bool
TogglePin::toggle()
{
_state = !_state;
digitalWrite(_pinNumber, _state ? HIGH : LOW);
return _state;
}

View file

@ -0,0 +1,19 @@
// This program is free software and is licensed under the same conditions as
// describe in https://github.com/sudar/Arduino-Makefile/blob/master/licence.txt
#ifndef TOGGLEPIN_H_
#define TOGGLEPIN_H_
class TogglePin
{
public:
TogglePin(int pinNumber, bool state);
bool toggle();
private:
const int _pinNumber;
bool _state;
};
#endif

View file

@ -0,0 +1,7 @@
# This program is free software and is licensed under the same conditions as
# describe in https://github.com/sudar/Arduino-Makefile/blob/master/licence.txt
# The following can be overridden at make-time, by setting an environment
# variable with the same name. eg. BOARD_TAG=pro5v328 make
BOARD_TAG ?= uno