Using softpack headers file for a project in Eclipse

Moderator: nferre

2Dooc
Posts: 4
Joined: Wed Jan 31, 2018 11:37 am

Using softpack headers file for a project in Eclipse

Tue Feb 20, 2018 4:46 pm

Hello everyone.

I need your help and advices.

I'v got a ubuntu 16.O4 LTS in dual boot with windows 8.1. I managed to boot the sama5d27-som1-ek board via flashing the linux4sam-poky-sama5d27_som1_ek_pda7b-5.7.img.bz2 image with etcher on an SD card.
The linux work, i can access on it by opening a serial terminal with the command: screen /dev/ttyACM0 115200
I would like to use the atmel-software- package-master (same as the sama5 softpack) with the eclipse IDE. I donwloaded the arm-linux-gnueabihf toolchain and imported it in eclipse and succeed to cross compile a simple Hello-world sent by ssh connection on the board and makes it run.

The idea is to create a single main.c in a c project using the header files and source code of the atmel-software- package-master . then to compile it to load it in the sd card and make it run. I imported the package as an include folder in the c project doing:
-right click on the c project
-properties
- path and symbols
-include
-add folder (where i select the directory of the atmel-software- package-master).

I can use the different header files but i need for each header files to specify precisely the path, header files which call other header files which are in different sub folders, it will be a very long process. Is there a way to just call a header file in my main.c without the need to specify each one of them, and make eclipse to automatically find the header files ?

Thanks to all of you

Regards
blue_z
Location: USA
Posts: 1676
Joined: Thu Apr 19, 2007 10:15 pm

Re: Using softpack headers file for a project in Eclipse

Wed Feb 21, 2018 2:54 am

2Dooc wrote:I donwloaded the arm-linux-gnueabihf toolchain and imported it in eclipse and succeed to cross compile a simple Hello-world sent by ssh connection on the board and makes it run.
A toolchain that is intended for bare-metal or standalone programs that used Newlib would probably be better suited than a toolchain intended for Linux with GNU glibc.
Consider using crosstool-NG to build a custom toolchain.

2Dooc wrote:The idea is to create a single main.c in a c project using the header files and source code of the atmel-software- package-master . then to compile it to load it in the sd card and make it run.
In all likelihood, your first program was built to execute from the internal SRAM of the SoC.
That internal SRAM is 128KBytes, which is the largest SRAM of any Atmel SoC so far, but is going to test your programming skills if you intend to implement a large program.
In order to execute a program out of external DRAM, aka main memory, you need a second-stage bootloader (that executes out of SRAM) to load & execute your standalone program.
Study the Booting Strategies chapter in the datasheet, and the first half of this topic .

2Dooc wrote:I imported the package as an include folder in the c project doing:
-right click on the c project
-properties
- path and symbols
-include
-add folder (where i select the directory of the atmel-software- package-master).
Folder is a GUI concept.
A filesystem has directories, not folders.

Are you sure you only need to use the header files from the Atmel Softpack?
There are initialization routines, device drivers, and libraries that you would have to code if you omit them.

2Dooc wrote:I can use the different header files but i need for each header files to specify precisely the path, header files which call other header files which are in different sub folders, it will be a very long process. Is there a way to just call a header file in my main.c without the need to specify each one of them, and make eclipse to automatically find the header files ?
An experienced Eclipse user will have to provide a definitive answer.

Make files typically have a variable named CFLAGS, and a path to additional header files can be specified to the gcc compiler using the -I option. (Type 'man gcc' in a Ubuntu terminal to get all the details.) The CFLAGS could list as many -I options as necessary to specify all the directories of relevant header files.

Regards
2Dooc
Posts: 4
Joined: Wed Jan 31, 2018 11:37 am

Re: Using softpack headers file for a project in Eclipse

Thu Feb 22, 2018 11:20 am

Hello Blue_z, i would like to thank you for you reply, i really appreciate.

In fact my purpose is to create an embedded web server.
So for that i would like to use linux, (lot of things have already been created like NTP HTTP protocol ,so we can just reuse what have been done) , i choose to flash an SD card in order to quickly set up linux and test the demo on the eval board. (In a second step i will have to set up linux without an Sd card).
I choose eclipse as an IDE to have an overview of different header files and to easily code but maybe, it's not appropriate ?
The idea is: the MPU will boot and initialize clock, IO, peripheral, set up the Linux and continue the process with the program that I will create/modify, to give you an idea for instance once linux is set up if someone connect a RJ45 cable and connect to the board, automatically a web page show up. That's why i wanted to do a single main (explaining the topic of this post) to just have one executable and make it run just after linux is set up, but it seems to not be the better way.

I don't really know how to proceed.
Do i have to use and modify the softpack example t ? Or maybe what is in the softpack it's in case I want to do a standalone program and if i have linux running i just need to download some packages to activate the webserver ? But I necessarily have to code something at a moment.
Or should I avoid the step of the sd card and directly create AT91bootstrap.bin uboot.bin the kernel image to configure it in the adequate memory (considering what you said about the SRAM and boot strategies) using sam-ba because of the place that the program will take ? But there is still the question at what moment and how will i have to code ?

What i want to achieve is certainly basic and i can look stupid to do not understand considering my questions, that's why i need someone to to show me the way and to explain me.

Thanks you again to take the time for these basics.

regards
blue_z
Location: USA
Posts: 1676
Joined: Thu Apr 19, 2007 10:15 pm

Re: Using softpack headers file for a project in Eclipse

Thu Feb 22, 2018 9:57 pm

You're asking XY questions.
If you want to write and run a standalone program that uses components from the Softpack, then continue with this topic.
If you want to develop a "embedded web server" which could be a standalone program, but typically accomplished with an OS such as Linux, then you have deviated from the title of this thread.

Your program is either standalone (meaning no operating system), or is developed to run under an OS.
For the former your program would have to control all of the hardware, and components from the Softpack could be useful.
For the latter the board boots the OS, the OS manages all of the hardware and the network protocol stack, and your program must adhere to any/all OS requirements.
Make a choice.
(I suggest you abandon this idea of a standalone program and using Softpack headers, and use an OS.)

You need to find other resources for such fundamental concepts as "why do I need an OS?" and developing an application program. .

Regards

Return to “SAMA5-based”

Who is online

Users browsing this forum: No registered users and 2 guests