Skip to content

Conversation

@tuna-f1sh
Copy link
Contributor

Following on from #565 , support for Arduino Due added to complete Arduino SAM support. Fairly minor changes:

  • Change from use of ALT_CORE_.. to SAM_CORE.. for readability as there is a bit more going on to pull together the core files on the Arduino Due. I don't think this has any impact as it was added in the original SAM pull request.
  • Catch empty CMSIS version detection to prevent basename flag complaining.
  • Escape character on grep string to prevent macOS BSD grep complaining.
  • Blink example for Arduino Due

@sudar
Copy link
Owner

sudar commented Jun 11, 2018

@sej7278

What are your thoughts on this?

@sudar sudar requested a review from sej7278 June 11, 2018 23:54
Copy link
Collaborator

@sej7278 sej7278 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't understand this bit that seems to replace ALTERNATE_CORE_PATH with SAM_CORE_PATH

@$(MKDIR) $(dir $@)
$(CC) -MMD -c $(CPPFLAGS) $(ASFLAGS) $< -o $@

# alt core files
Copy link
Collaborator

@sej7278 sej7278 Jun 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this going to break non-sam alternate cores like attiny?

edit: actually i see if was added when sam support was added, so probably ok to rename (might even be better that way!)

CXXFLAGS += -fno-threadsafe-statics -flto -fno-devirtualize -fdiagnostics-color
CFLAGS += -flto -fno-fat-lto-objects -fdiagnostics-color
CXXFLAGS += -fno-threadsafe-statics -flto -fno-devirtualize -fdiagnostics-color=$(DIAGNOSTICS_COLOR_WHEN)
CFLAGS += -flto -fno-fat-lto-objects -fdiagnostics-color=$(DIAGNOSTICS_COLOR_WHEN)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this need rebasing as the COLOR_WHEN stuff has already been merged?

- Tweak: Update Windows usage documentation and allow non-relative paths (issue #519) (https://github.com/tuna-f1sh)
- Tweak: Support Cygwin Unix Python and Windows installation on Windows to pass correct port binding. (https://github.com/tuna-f1sh)
- New: Added -fdiagnostics-color to \*STD flags (https://github.com/sej7278)
- New: Made -fdiagnostics-color take a variiable DIAGNOSTICS_COLOR_WHEN: never, always, auto. (https://github.com/wingunder)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

color diagnostics has already been merged, need to add Due comment to history

@sej7278
Copy link
Collaborator

sej7278 commented Jun 12, 2018

looks like it needs rebasing as the DIAGNOSTICS_COLOR_WHEN stuff has already been merged, also need Due support added to HISTORY.md

@tuna-f1sh
Copy link
Contributor Author

Yes the ALTERNATIVE_CORE stuff looks like a big change but as you picked up, it's something that I added when doing the SAM support and think the naming it SAM_CORE is easier for readability.

Think the DIAGNOSTICS_COLOR_WHEN stuff got pulled in as I merged upstream after starting work. I did do a rebase so I'll have to dig deeper as to how to eliminate this change, which is already in master, unless you have any tips?

@tuna-f1sh tuna-f1sh force-pushed the due branch 2 times, most recently from 6556c1f to eb56d90 Compare June 12, 2018 13:02
@tuna-f1sh
Copy link
Contributor Author

Ok, I sorted out why my rebase didn't adjust for the upstream/master changes; I'd rebased to my local master prior doing a merge of upstream/master.

Copy link
Collaborator

@sej7278 sej7278 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all looks good to me now

@jskang94
Copy link

jskang94 commented Jun 14, 2018

void setup() {
    Serial.begin(9600);
}

void loop() {
    float foo = random(1000) * 0.001;
    Serial.println(String("foo: ") + foo);
}

this code yields this error

...
/home/kjs-ubuntu/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-gcc -T/home/kjs-ubuntu/.arduino15/packages/arduino/hardware/sam/1.6.11/variants/arduino_due_x/linker_scripts/gcc/flash.ld -Wl,-Map=build-arduino_due_x/DueBlink.map -o build-arduino_due_x/DueBlink.elf build-arduino_due_x/DueBlink.ino.o   /home/kjs-ubuntu/.arduino15/packages/arduino/hardware/sam/1.6.11/variants/arduino_due_x/libsam_sam3x8e_gcc_rel.a -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--start-group -u _sbrk -u link -u _close -u _fstat -u _isatty -u _lseek -u _read -u _write -u _exit -u kill -u _getpid -L/home/kjs-ubuntu/.arduino15/packages/arduino/hardware/sam/1.6.11/system/CMSIS/CMSIS/Lib/GCC -lm  -mcpu=cortex-m3 -Wl,--gc-sections -Os build-arduino_due_x/libcore.a -Wl,--end-group
build-arduino_due_x/libcore.a(WString.cpp.o): In function `String::concat(float)':
WString.cpp:(.text._ZN6String6concatEf+0x14): undefined reference to `dtostrf'
collect2: error: ld returned 1 exit status
/home/kjs-ubuntu/project/ubdp/UDSL/submodules/ubduino/submodules/Arduino-Makefile/Arduino.mk:1554: recipe for target 'build-arduino_due_x/DueBlink.elf' failed
make: *** [build-arduino_due_x/DueBlink.elf] Error 1

there's avr directory under $(ARDUINO_CORE_PATH), and it seems like you're missing it, so adding this works ok

--- a/Arduino.mk
+++ b/Arduino.mk
@@ -830,8 +830,9 @@ ifeq ($(strip $(NO_CORE)),)
         CORE_CPP_SRCS   = $(wildcard $(ARDUINO_CORE_PATH)/*.cpp)
         CORE_AS_SRCS    = $(wildcard $(ARDUINO_CORE_PATH)/*.S)

-        # USB Core if samd or sam
+        # USB / dtostrf hack if samd or sam
         ifeq ($(findstring sam, $(strip $(ARCHITECTURE))), sam)
+            CORE_C_SRCS    += $(wildcard $(ARDUINO_CORE_PATH)/avr/*.c)
             CORE_C_SRCS    += $(wildcard $(ARDUINO_CORE_PATH)/USB/*.c)
             CORE_CPP_SRCS  += $(wildcard $(ARDUINO_CORE_PATH)/USB/*.cpp)
         endif

@tuna-f1sh
Copy link
Contributor Author

Good spot, looks like it's just the emulation of the dtostrf - I've added it now.

Update HISTORY.md

Add avr core emulation to C sources
@sudar sudar merged commit b2d1ff2 into sudar:master Jun 22, 2018
@sudar
Copy link
Owner

sudar commented Jun 22, 2018

@tuna-f1sh

Thanks for your contribution.

@sej7278

Thanks for reviewing the PR.

@tuna-f1sh
Copy link
Contributor Author

tuna-f1sh commented Jul 13, 2019 via email

@wlwatkins
Copy link

Thks, I actually saw it right after writing the comment, hence why i deleted my comment. (you know you need to dial tech support for your computer to fix ^^ ) thanks again.

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

Successfully merging this pull request may close these issues.

5 participants