How to create C++ project with ASF for SAM4S

All design tool related questions: compiler, assembler, linker. Embedded programming questions: assembler, C code.

Moderator: nferre

TGPTIAlves
Posts: 8
Joined: Wed Oct 15, 2014 7:24 pm

How to create C++ project with ASF for SAM4S

Fri Oct 17, 2014 3:22 am

Hello,

I've lost the last 3 houras trying to figure this out but I can't. I was able to create a C project and upload code to my SAM4S XPLAINED PRO (using it as a user board).

My new goal is to make the same example program but with the project configured in C++. Here is what I tried:

1st try:
- Created a new Project GCC C++ Example Project.
- Selected ATSAM4SD32C as the microprocessor.
- Add ASF and configure it for User Board.
- Added the libraries with ASF I needed (Generic Board Support, IOPORT, GPIO, System Clock Control and Delay Routines)
- Try to compile the empty project and got this error: - Try to compile the empty project and got the same error as above: Error 1 cannot open linker script file sam4sd32c_flash.ld: No such file or directory 1 1 GccApplication1
- Attempted to fill with code only to get the same error


2nd try:

- Created a new Project GCC C++ Example Project.
- Selected ATSAM4SD32C as the microprocessor.
- Add ASF and configure it for User Board.
- Try to compile the empty project and got the same error as above: Error 1 cannot open linker script file sam4sd32c_flash.ld: No such file or directory 1 1 GccApplication1


3rd Try:
- Created a new Project GCC C++ Example Project.
- Selected ATSAM4SD32C as the microprocessor.
- I noticed that when I configure ASF a CMSIS folder is deleted which contains sam4sd32c_flash.ld. Before I configured ASF this time, I took a copy of the CMSIS folder.
- Add ASF and configure it for User Board.
- Place the copied CMSIS folder on its original folder.
- Tried to compile the empty project and got two main functions error. Deleted then the main.c created by the ASF configuration and compiled it again and it suceeded.
- Fill my program with the code (equal to C code I had working) and successfully compiled it but the board did nothing.
- I repeated this whole process but instead of deleting main.c I deleted the other file with the main function but the board did nothing again.



Any help will be appriciated. Thanks!

 
jharley
Posts: 238
Joined: Thu Dec 06, 2012 6:40 am

Re: How to create C++ project with ASF for SAM4S

Fri Oct 17, 2014 4:28 am

TGPTIAlves
Posts: 8
Joined: Wed Oct 15, 2014 7:24 pm

Re: How to create C++ project with ASF for SAM4S

Sun Oct 19, 2014 1:25 am

Thanks for the link, but it didn't work. While I was trying to follow on the suggested things of that topic, I learned something and managed to work by myself. So here's waht it is needed to do for those with problems:




(Atmel Studio 6.2)
- Create new GCC C++ Executable Project
- Select your MCU (mine was SAM4SD32C)
- Open ASF and select your board (Mine was User Board)
- Delete the new main.c file created
- Right click on the project -> properties ->Toolchain -> ARM/GNU Linker -> Miscellaneous. In the linker flags there should be two parameters, both starting with -T and are separated by a space. Delete the first one.




The project should now work with ASF and C++.

Return to “Development Tools”

Who is online

Users browsing this forum: No registered users and 2 guests