Build AT91Bootstrap from sources

Discussions about all user software around SAM Series.

Moderator: nferre

mohsenie
Posts: 1
Joined: Sun Aug 19, 2012 12:25 am

Build AT91Bootstrap from sources

Sun Aug 19, 2012 12:54 am

Hi everyone. I am trying to compile AT91Bootstrap for my "AT91SAM9G25" based board as per instructions on this page linux4sam/bin/view/Linux4SAM/SAM9x5Page ... om_sources but i get some errors listed below that i can't fix:

Code: Select all

/home/mohsen/Desktop/AT91Bootstrap-5series_1.2/driver/ff.o: In function `create_name':
/home/mohsen/Desktop/AT91Bootstrap-5series_1.2/driver/ff.c:1338: undefined reference to `__stack_chk_guard'
/home/mohsen/Desktop/AT91Bootstrap-5series_1.2/driver/ff.o: In function `f_open':
/home/mohsen/Desktop/AT91Bootstrap-5series_1.2/driver/ff.c:1891: undefined reference to `__stack_chk_fail'
/home/mohsen/Desktop/AT91Bootstrap-5series_1.2/driver/ff.c:1891: undefined reference to `__stack_chk_guard'
/home/mohsen/Desktop/AT91Bootstrap-5series_1.2/driver/ds24xx.o: In function `load_1wire_info':
/home/mohsen/Desktop/AT91Bootstrap-5series_1.2/driver/ds24xx.c:574: undefined reference to `__stack_chk_guard'
/home/mohsen/Desktop/AT91Bootstrap-5series_1.2/driver/ds24xx.c:604: undefined reference to `__stack_chk_fail'
/home/mohsen/Desktop/AT91Bootstrap-5series_1.2/driver/ds24xx.c:604: undefined reference to `__stack_chk_guard'
make: *** [/home/mohsen/Desktop/AT91Bootstrap-5series_1.2/binaries/at91sam9x5ek-sdcardboot-3.1.bin] Error 1
I understand that the errors are associated with stack over flow check done by the compiler and can be fixed by disabling this check but have got no clue how to fix it. In fact i tried to edit the top level Makefile and added "-fno-stack-protector" to line 95 and 96 so it looks like

Code: Select all

AS=$(CROSS_COMPILE)gcc -fno-stack-protector
CC=$(CROSS_COMPILE)gcc -fno-stack-protector
and it did compile but generated bin file in the binaries folder does not seem to boot the board.
I am compiling on Ubuntu12 with gcc for arm "arm-linux-gnueabi-"

I appreciate any help
blue_z
Location: USA
Posts: 1786
Joined: Thu Apr 19, 2007 10:15 pm

Re: Build AT91Bootstrap from sources

Mon Aug 20, 2012 9:59 am

mohsenie wrote:I am compiling on Ubuntu12 with gcc for arm "arm-linux-gnueabi-"
The salient problem is that "arm-linux-gnueabi" is a cross-compiler for code targeted to run under Linux. The bootstrap program does not run under Linux. It's a standalone program, aka "bare metal". You need a compiler that is "arm-none-...".

You should read and follow the README.txt file that accompanied the AT91Bootstrap source code. Compiler tools that have proven to work and the site to download those tools are mentioned.

The proven compiler also predates the stack smashing protector issue that you are encountering. No need for Makefile kludges.

BTW for completeness, you should have specified the version of compiler and libraries that you are using.
In fact i tried to edit the top level Makefile and added "-fno-stack-protector" to line 95 and 96 so it looks like

Code: Select all

AS=$(CROSS_COMPILE)gcc -fno-stack-protector
CC=$(CROSS_COMPILE)gcc -fno-stack-protector
That's an ugly hack. You are overloading variables intended for specifying the compiler and assembler. The proper way to do this is to use the CFLAGS variable for adding compile-time flags. Overloading variables or procedures or modules may seem expedient, but can lead to sloppiness and/or headaches for the next maintainer.

Regards

Return to “Software”

Who is online

Users browsing this forum: No registered users and 1 guest