public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] Query on weak function for board specific initialisation
@ 2015-04-30 12:57 maitysanchayan at gmail.com
  2015-05-30 14:44 ` Jeroen Hofstee
  0 siblings, 1 reply; 3+ messages in thread
From: maitysanchayan at gmail.com @ 2015-04-30 12:57 UTC (permalink / raw)
  To: u-boot

Hello,

I am trying to use a weak function in able to provide a board specific
initialisation. To be more specific, I am trying to use the __weak
board_ehci_hcd_init function in the usb driver code which is called in
ehci_hcd_init, the strong function being defined in the board file.
This is on lines similar to what I see in the ehci-mx6 driver and some
mx6 board files like nitrogen's.

Getting a linker error on compiling which is perplexing me at the
moment.

[snip]
drivers/usb/host/built-in.o: In function `ehci_hcd_init':
/home/sanchayan/uboot/u-boot/drivers/usb/host/ehci-vf.c:185:
undefined reference to `board_echi_hcd_init'
/home/sanchayan/gcc-linaro/bin/arm-linux-gnueabihf-ld.bfd: BFD
(crosstool-NG linaro-1.13.1-2012.09-20120921 - Linaro GCC 2012.09) 2.22
assertion fail
/cbuild/slaves/oort14/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/src/binutils-2.22/bfd/elf32-arm.c:7498
/home/sanchayan/gcc-linaro/bin/arm-linux-gnueabihf-ld.bfd: BFD
(crosstool-NG linaro-1.13.1-2012.09-20120921 - Linaro GCC 2012.09) 2.22
assertion fail
/cbuild/slaves/oort14/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/src/binutils-2.22/bfd/elf32-arm.c:13830
/bin/sh: line 1:  1110 Segmentation fault      (core dumped)

Perhaps I am overlooking something trivial? A diff is attached, the
changes are minimal. I am using our local branch of uboot at 2015.04 and
the gcc linaro toolchain.

Thanks & Regards,
Sanchayan Maity.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: usb-iris.patch
Type: text/x-diff
Size: 2686 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150430/2d74394d/attachment.patch>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] Query on weak function for board specific initialisation
  2015-04-30 12:57 [U-Boot] Query on weak function for board specific initialisation maitysanchayan at gmail.com
@ 2015-05-30 14:44 ` Jeroen Hofstee
  2015-05-31  7:34   ` maitysanchayan at gmail.com
  0 siblings, 1 reply; 3+ messages in thread
From: Jeroen Hofstee @ 2015-05-30 14:44 UTC (permalink / raw)
  To: u-boot

Hello Maity,

On 30-04-15 14:57, maitysanchayan at gmail.com wrote:
> Hello,
>
> I am trying to use a weak function in able to provide a board specific
> initialisation. To be more specific, I am trying to use the __weak
> board_ehci_hcd_init function in the usb driver code which is called in
> ehci_hcd_init, the strong function being defined in the board file.
> This is on lines similar to what I see in the ehci-mx6 driver and some
> mx6 board files like nitrogen's.
>
> Getting a linker error on compiling which is perplexing me at the
> moment.
>
> [snip]
> drivers/usb/host/built-in.o: In function `ehci_hcd_init':
> /home/sanchayan/uboot/u-boot/drivers/usb/host/ehci-vf.c:185:
> undefined reference to `board_echi_hcd_init'
> /home/sanchayan/gcc-linaro/bin/arm-linux-gnueabihf-ld.bfd: BFD
> (crosstool-NG linaro-1.13.1-2012.09-20120921 - Linaro GCC 2012.09) 2.22
> assertion fail
> /cbuild/slaves/oort14/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/src/binutils-2.22/bfd/elf32-arm.c:7498
> /home/sanchayan/gcc-linaro/bin/arm-linux-gnueabihf-ld.bfd: BFD
> (crosstool-NG linaro-1.13.1-2012.09-20120921 - Linaro GCC 2012.09) 2.22
> assertion fail
> /cbuild/slaves/oort14/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/src/binutils-2.22/bfd/elf32-arm.c:13830
> /bin/sh: line 1:  1110 Segmentation fault      (core dumped)
>
> Perhaps I am overlooking something trivial?


I suppose you found this already, but for completeness, you made a typo:

board_ehci_hcd_init
board_echi_hcd_init

To prevent trouble like this, the compiler should actually be set to warn
if there is no prototype...

Regards,
Jeroen

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] Query on weak function for board specific initialisation
  2015-05-30 14:44 ` Jeroen Hofstee
@ 2015-05-31  7:34   ` maitysanchayan at gmail.com
  0 siblings, 0 replies; 3+ messages in thread
From: maitysanchayan at gmail.com @ 2015-05-31  7:34 UTC (permalink / raw)
  To: u-boot

Hello Jeroen,

On 15-05-30 16:44:32, Jeroen Hofstee wrote:
> Hello Maity,
> 
> On 30-04-15 14:57, maitysanchayan at gmail.com wrote:
> >Hello,
> >
> >I am trying to use a weak function in able to provide a board specific
> >initialisation. To be more specific, I am trying to use the __weak
> >board_ehci_hcd_init function in the usb driver code which is called in
> >ehci_hcd_init, the strong function being defined in the board file.
> >This is on lines similar to what I see in the ehci-mx6 driver and some
> >mx6 board files like nitrogen's.
> >
> >Getting a linker error on compiling which is perplexing me at the
> >moment.
> >
> >[snip]
> >drivers/usb/host/built-in.o: In function `ehci_hcd_init':
> >/home/sanchayan/uboot/u-boot/drivers/usb/host/ehci-vf.c:185:
> >undefined reference to `board_echi_hcd_init'
> >/home/sanchayan/gcc-linaro/bin/arm-linux-gnueabihf-ld.bfd: BFD
> >(crosstool-NG linaro-1.13.1-2012.09-20120921 - Linaro GCC 2012.09) 2.22
> >assertion fail
> >/cbuild/slaves/oort14/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/src/binutils-2.22/bfd/elf32-arm.c:7498
> >/home/sanchayan/gcc-linaro/bin/arm-linux-gnueabihf-ld.bfd: BFD
> >(crosstool-NG linaro-1.13.1-2012.09-20120921 - Linaro GCC 2012.09) 2.22
> >assertion fail
> >/cbuild/slaves/oort14/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/src/binutils-2.22/bfd/elf32-arm.c:13830
> >/bin/sh: line 1:  1110 Segmentation fault      (core dumped)
> >
> >Perhaps I am overlooking something trivial?
> 
> 
> I suppose you found this already, but for completeness, you made a typo:
> 
> board_ehci_hcd_init
> board_echi_hcd_init
> 
> To prevent trouble like this, the compiler should actually be set to warn
> if there is no prototype...

Yes, I found the error and also posted the patch. Thanks for the tip, I do
not have that switch turned on, will do so. Lack of sleep and resulting
lack of attention to detail resulted in the trivial noise post :).

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-05-31  7:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-30 12:57 [U-Boot] Query on weak function for board specific initialisation maitysanchayan at gmail.com
2015-05-30 14:44 ` Jeroen Hofstee
2015-05-31  7:34   ` maitysanchayan at gmail.com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox