Go Down

Topic: Arduino on Xcode Project — Official Thread (Read 227040 times) previous topic - next topic

Andreas_Gaunitz

I put a cpp file named "embeddedcomputing.cpp", and another "main.cpp" and another "MyProjectName.cpp" with the contents of MyProjectName.ino in both the Build folder and the project folder.

Tried avr-objdump -I and gave it 1) project directory, 2) build directory, 3) cpp file name, and 4) ino file name

Still no C code :(

avenue33

I don't know.

I guess the solution consists on comparing the trace of the building and linking process with Arduino.CC 1.6.5 and embedXcode line per line.

westfw

For quite a while, in order to get line numbers from errors "correct", the arduino pre-processing was adding lines that looked like:
#line 1 blink.ino
to the .cpp file that it created in the build directory during pre-processing.  This of course is what gets propagated to the .elf files, and is used by objdump.   Since the build directory didn't actually have a copy of the .ino file, this broke the source inter-mingling of disassembly.  It was fixed relatively recently.

https://github.com/arduino/Arduino/issues/1337


avenue33

Because embedXcode relies on standard C++ and makefile implementation, it doesn't need the #line 1 blink.ino trick.

The compiler starts with the void main() function, located on the main.cpp. The main.cpp includes the statement #include "blink.ino".

Should an error be reported, clicking on it goes right to the line of code.

Andreas_Gaunitz

This was fixed already in Arduino 1.6.6, which is the version I am using. There's something else going on on my end...

Andreas_Gaunitz

#770
Dec 24, 2015, 03:38 pm Last Edit: Dec 24, 2015, 04:14 pm by Andreas_Gaunitz
After a lot of testing, I realized that the problem was a missing gcc directive in the included makefile.

If you are having the same problems (no intermixed C++ source code when using avr-objdump -S) please make sure that the makefiles ArduinoAVR_165.mk and ArduinoAVR_177.mk contain the -g flag

I added it in both files like this:
Quote
CPPFLAGS     = -g $(OPTIMISATION) $(WARNING_FLAGS)
CPPFLAGS    += -$(MCU_FLAG_NAME)=$(MCU) -DF_CPU=$(F_CPU)
CPPFLAGS    += -ffunction-sections -fdata-sections
CPPFLAGS    += $(addprefix -D, printf=iprintf $(PLATFORM_TAG))
CPPFLAGS    += $(addprefix -I, $(INCLUDE_PATH))
Was previously (EmbedXcode version 4.0.3):
Quote
CPPFLAGS     = $(OPTIMISATION) $(WARNING_FLAGS)
CPPFLAGS    += -$(MCU_FLAG_NAME)=$(MCU) -DF_CPU=$(F_CPU)
CPPFLAGS    += -ffunction-sections -fdata-sections
CPPFLAGS    += $(addprefix -D, printf=iprintf $(PLATFORM_TAG))
CPPFLAGS    += $(addprefix -I, $(INCLUDE_PATH))
I also noted another anomaly: in the Configurations/Arduino Nano ATmega328.xcconfig
Quote
MAX_RAM_SIZE = 1024
should be
Quote
MAX_RAM_SIZE = 2048
Merry Christmas!!!
/ Andreas

avenue33

#771
Dec 24, 2015, 03:57 pm Last Edit: Dec 24, 2015, 03:59 pm by avenue33
@Andreas_Gaunitz

Thank you for investigating and congratulations for finding the solution!

The -g is activated for the Debug target on the platforms that support debugging, e.g. Zero, M0 Pro, LaunchPads, mbed-enabled boards on embedXcode+.

I'll include it in a next few release.

DeafSoul

#772
Dec 30, 2015, 01:11 pm Last Edit: Dec 30, 2015, 01:20 pm by DeafSoul
Hi Guys,
I've been using embedXcode for some time now and i love it.
I migrated my arduino project recently to a breadboard, where i use an arduino as an ISP to program the Atmega328p. This works perfectly from the Arduino IDE (shift + upload)...

The question is: how do I change the makefiles of embedXcode such that the "Upload" scheme would use the arduino as ISP ??

I appreciate your ideas.
DeafSoul

avenue33

Please find a new release of embedXcode.

Release 4.1.9 adds support for Arduino.CC Zero. Please use the Programming Port to upload the sketch.

Release 4.1.8 updates the Intel Galileo and Edison upload procedure.

Download

avenue33

Hi Guys,
I've been using embedXcode for some time now and i love it.
I migrated my arduino project recently to a breadboard, where i use an arduino as an ISP to program the Atmega328p. This works perfectly from the Arduino IDE (shift + upload)...

The question is: how do I change the makefiles of embedXcode such that the "Upload" scheme would use the arduino as ISP ??

I appreciate your ideas.
DeafSoul
Please have a look at chapter 3 section 5 of the User Manual.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy