From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ilko Iliev Date: Wed, 22 Oct 2008 15:07:50 +0200 Subject: [U-Boot] [PATCH] at91: board specific lowlevel_init.S In-Reply-To: <20081022124136.GA10916@game.jcrosoft.org> References: <48FDDC1C.2080808@ronetix.at> <20081021135853.C5D84835694E@gemini.denx.de> <48FDFCA0.4090608@ronetix.at> <20081021190831.27E0C835694E@gemini.denx.de> <48FF0A83.5000805@ronetix.at> <20081022124136.GA10916@game.jcrosoft.org> Message-ID: <48FF25A6.7040601@ronetix.at> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Jean-Christophe PLAGNIOL-VILLARD wrote: > On 13:12 Wed 22 Oct , Ilko Iliev wrote: > >> Dear Mr. Denk, >> >> >>> Dear Ilko Iliev, >>> >>> In message <48FDFCA0.4090608@ronetix.at> you wrote: >>> >>> >>>>> Maybe instead of adding mor #ifdef'ery here, we can turn >>>>> lowlevel_init() into a "weak" function that can be redefined by board >>>>> specific code? >>>>> >>>>> >>>> The lowlevel_init() is an assembler function called from another >>>> assembler function and the attribute .weak doesn't work. >>>> >>>> >>> What do you mean by "attribute .weak doesn't work" ? >>> >>> >>> >>>> There are no assembler file in the U-BOOT tree which use weak functions. >>>> Do you know how can I make an assembler function weak? >>>> >>>> >>> Well, if you don't know, then don't ask me, ask your compiler - he >>> knows how to do this. >>> >>> For example, common/cmd_boot.c has this code snippet right at the >>> beginning: >>> >>> 30 >>> 31 /* Allow ports to override the default behavior */ >>> 32 __attribute__((weak)) >>> 33 unsigned long do_go_exec (ulong (*entry)(int, char *[]), int argc, char *argv[]) >>> 34 { >>> 35 return entry (argc, argv); >>> 36 } >>> >>> Compile this with -S option, and you get this: >>> >>> 12 .Ltext0: >>> 13 .align 2 >>> 14 .weak do_go_exec >>> 15 .type do_go_exec, @function >>> 16 do_go_exec: >>> 17 .LFB87: >>> 18 .file 1 "cmd_boot.c" >>> 19 .loc 1 34 0 >>> 20 .LVL0: >>> 21 mflr 0 >>> 22 .LCFI0: >>> 23 stwu 1,-16(1) >>> ... >>> >>> >>> So to me it seems as if the attribute .weak is supposed to work just fine. >>> >>> What exactly is not working for you? >>> >>> >>> >> With ".weak lowlevel_init" the function is marked as weak (I can see >> this in the ELF file) but it is not overwritten from the another >> lowlevel_init(). >> > try > .weak __default_lowlevel_init = lowlevel_init > > I tried and the result is: lowlevel_init.S:32: Error: junk at end of line, first unrecognized character is `=' I' using arm-elf-gcc 4.1.1 -- Mit freundlichen Gr??en/With best regards, Ilko Iliev Ronetix Development Tools GmbH CPU Modules, JTAG/BDM Emulators and Flash Programmers Waidhausenstrasse 13/5, 1140 Vienna, Austria E-Mail: iliev at ronetix.at; Web: www.ronetix.at