Help setting up Eclipse development environment on Mac - SOLVED

I am trying to set up an Eclipse development environment for building the core firmware. I have GIT, GNU, and the rest of the command line development tools installed. I can successfully build the firmware and flash to the device from the command line. I downloaded and installed the latest Eclipse IDE installed with the CDT plug-in and added the GIT repositories, however I can’t figure out how to get it to build. Does anyone have a Eclipse dev environment setup and working where they can build the firmware and flash the core? Also had anyone been able to get debugging using the JTAG shield and a JTAG device working within Eclipse?

Thanks for any help.

How I did it:

  1. Clone project from command line
  2. Import -> Existing Code as Makefile Project
  3. For each project, Select project, and mark GNU Autotools as Toolchain
  4. for core-firmware I had to add a make target: Menu Project -> Make Target -> add “all”, and another target “clean”
  5. Set build dir: Project -> Properties -> C/C++ Build: Tab “Builder Settings”, Build-Directory: ${workspace_loc:/core-firmware}/build
  6. make sure arm-none-eabi-cpp is in the path. Project -> Properties -> C/C++ Build -> Environment -> add “PATH”
  7. Project -> build all (should make the same binary as from command line)

it’s been a while, that’s all i remember. good luck.

@Coffee That did it! Thanks. My mistake was to import the project using: "Import->Git->Projects from git."
I removed those ‘git’ projects and started over, importing them from local directories (which I had used “git clone https:…” to download them locally).

For some reason I don’t understand, importing them using Git within Eclipse will not give you the C/C++ property associations on that project.

I’m also looking for a Eclipse project file with the correct settings

@JvD - Where are you in the process of setting up your environment? I can try to help.

Have you done the following?

1 : The instructions for getting setup to build the firmware are here https://github.com/spark/core-firmware

2 : The is a lot of information on the web for getting and setting up Eclipse on your platform, be sure to install the CDT environment for C++/C.

3 : Once you have completed #1, then follow @Coffee’s instructions above.

@mtnscott the problems with compiling the source code is solved. But I still have problems with debugging the code. Below a short log file made during programming and debugging.

Firmware: J-Link ARM V8 compiled Nov 25 2013 19:20:08

Hardware: V8.00

OEM: IAR

Checking target voltage...

Listening on TCP/IP port 2331

Connecting to target...Connected to target

Waiting for GDB connection...Connected to 127.0.0.1

Reading all registers

Read 1 bytes @ address 0x00000000 (Data = 0x00)

Reading register (PRIMASK = 0x00000000)

Select SWD as target interface

Target interface speed set to 30 kHz

Selecting device: STM32F103CB

Target endianess set to "little endian"

Resetting target

Halting target CPU...

...Target halted (PC = 0x0800010C)

Select auto target interface speed (2000 kHz)

Semi-hosting enabled (VectorAddr = 0x08)

Semihosting I/O set to TELNET Client

SWO disabled succesfully.

SWO enabled succesfully.

Flash breakpoints enabled

Flash download enabled

Downloading 268 bytes @ address 0x08005000 - Verified OK

Downloading 16128 bytes @ address 0x08005110 - Verified OK

Downloading 16000 bytes @ address 0x08009010 - Verified OK

Downloading 16224 bytes @ address 0x0800CE90 - Verified OK

Downloading 16076 bytes @ address 0x08010DF0 - Verified OK

Downloading 72 bytes @ address 0x08014CBC - Verified OK

Downloading 2832 bytes @ address 0x08014D04 - Verified OK

WARNING: CPU is running at low speed (8011 kHz).

Writing register (R8 = 0x08005110)

Read 1 bytes @ address 0x08005110 (Data = 0x84)

Read 1 bytes @ address 0x08005728 (Data = 0x10)

Read 1 bytes @ address 0x08005728 (Data = 0x10)

Read 1 bytes @ address 0x08005728 (Data = 0x10)

Read 1 bytes @ address 0x08005728 (Data = 0x10)

Reading 14 bytes @ address 0x08005728

Read 1 bytes @ address 0x08005728 (Data = 0x10)

Read 1 bytes @ address 0x08005728 (Data = 0x10)

Read 1 bytes @ address 0x08005728 (Data = 0x10)

Read 1 bytes @ address 0x08005728 (Data = 0x10)

Read 1 bytes @ address 0x08005728 (Data = 0x10)

Read 1 bytes @ address 0x08005728 (Data = 0x10)

Read 1 bytes @ address 0x08005728 (Data = 0x10)

Read 1 bytes @ address 0x08005728 (Data = 0x10)

Reading 14 bytes @ address 0x08005728

Read 1 bytes @ address 0x08005728 (Data = 0x10)

Read 1 bytes @ address 0x08005728 (Data = 0x10)

Read 1 bytes @ address 0x08005728 (Data = 0x10)

Read 1 bytes @ address 0x08005728 (Data = 0x10)

Read 1 bytes @ address 0x08005728 (Data = 0x10)

Read 1 bytes @ address 0x08005728 (Data = 0x10)

Read 1 bytes @ address 0x08005728 (Data = 0x10)

Reading 14 bytes @ address 0x08005728

Read 1 bytes @ address 0x08005728 (Data = 0x10)

Read 1 bytes @ address 0x08005728 (Data = 0x10)

Read 1 bytes @ address 0x08005728 (Data = 0x10)

Read 1 bytes @ address 0x08005728 (Data = 0x10)

Resetting target

Halting target CPU...

...Target halted (PC = 0x0800010C)

Setting breakpoint @ address 0x08005728, Size = 4, BPHandle = 0x0002

Starting target CPU...

...Breakpoint reached @ address 0x08005728

Reading all registers

Removing breakpoint @ address 0x08005728, Size = 4

WARNING: Failed to read memory @ address 0xD7CFEFDE

Read 1 bytes @ address 0xD7CFEFDE (Data = 0xAA)

WARNING: Failed to read memory @ address 0xD7CFEFDE

Read 1 bytes @ address 0xD7CFEFDE (Data = 0xAA)

WARNING: Failed to read memory @ address 0xD7CFEFDE

Read 1 bytes @ address 0xD7CFEFDE (Data = 0xAA)

Reading 64 bytes @ address 0x20005000

WARNING: Failed to read memory @ address 0x20005000

Reading 64 bytes @ address 0x20005000

WARNING: Failed to read memory @ address 0x20005000

These last actions are strange, 0xD7CFEFDE is not valid and also 0x20005000 is out of the SRAM memory space.

Can I ask a favour. I am still at the stage before, trying to get GIT GNU and the rest installed.

I am using a MacBook Pro, OSX 10.7.x but would really appreciated a bit more detail on the all the steps required to build offline.

I am working from South Africa and although I have a 4Mb/s link, working (especially flashing) via the IDE is NOT an option, if lucky something as small as the Flashing LED could take 3-4 minutes…

So, if you have a simple Howto, or can point me in the right direction for some NOOB details, much appreciated.

@JvD - Sorry I don’t have a debugging environment and can’t really help. I have the JTAG shield on order so when that arrives I may need your help :smile:

hi @ammaree, It has been a while since I installed eclipse on my mac but I searched my history and I found this to be a helpful link - http://horrorcoding.altervista.org/arduino-development-with-eclipse-a-step-by-step-tutorial-to-the-basic-setup/

Until now I used the toolchain to create and run a number of test programs to get familiar with the whole environment on my MacBook. I used a simple text editor (TextWrangler) to do the coding and after building I use the dfu-util to flash the program to the SparkCore, all via the command line.

Because my programs are becoming more complex I decided to use Eclipse, I installed it based on the instructions of @Coffee and created 3 projects: core-common-lib, core-communication-lib and core-firmware. In the core-firmware I added my own software ( .cpp in the src folder and .h files in the inc folder) and updated the build.mk file accordingly.
Unfortunately I now get a lot of errors (or warnings, i am not sure) in one of the cpp files, see the code snipped below.

void InitializeTimer2() { // See core-common-lib/STM32F10x_StdPeriph_Driver/inc/stm32f10x_tim.h
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE); // RCC: Reset and Clock Control
TIM_TimeBaseInitTypeDef timerInitStructure2;
timerInitStructure2.TIM_Prescaler = 40000; // Max 65536, clock 72MHz (= 13.8ns)
timerInitStructure2.TIM_CounterMode = TIM_CounterMode_Up;
timerInitStructure2.TIM_Period = 15000; // Max 65536, Auto Reload Register ?
timerInitStructure2.TIM_ClockDivision = TIM_CKD_DIV1;
timerInitStructure2.TIM_RepetitionCounter = 0;
TIM_TimeBaseInit(TIM2, &timerInitStructure2);
TIM_ClearITPendingBit(TIM2, TIM_IT_Update); //Clear the interrupt bit
TIM_Cmd(TIM2, ENABLE);

}

Eclipse complains with e.g. the following message:

Multiple markers at this line
	- Symbol 'TIM_CounterMode_Up' could not be resolved
	- Field 'TIM_CounterMode' could not be resolved

Probably there is a missing include path to the core-common-lib/STM32F10x_StdPeriph_Driver/inc/stm32f10x_tim.h file.
Any idea how to solve this?

Thanks,
Henk

remember that you need the following include in your own .h files:

#include "application.h"

else the “arduino-functions” will not be found.

Did you do all the imports? is the order of the functions correct?

Hi @Coffee, I dubble checked my .h files and they all include “application.h”. The strange thing is that when I build via the command line I don’t get those errors.
EDIT: Therefor I think that it is a setting within Eclipse.