public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Max Krummenacher <max.oss.09@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] hello_world.c: fix entry point in case of arm thumb binary
Date: Tue, 15 Aug 2017 14:24:41 +0200	[thread overview]
Message-ID: <1502799881.3076.18.camel@gmail.com> (raw)
In-Reply-To: <20170814211531.GN20467@bill-the-cat>

Hello all

Am Montag, den 14.08.2017, 17:15 -0400 schrieb Tom Rini:

On Sat, Aug 12, 2017 at 11:03:46AM +0200, Max Krummenacher wrote:



If compiling for thumb the U-Boot 'go' command can not jump to the entry
point, as the jump will be done in the assumption that the code jumped to
is using the arm instruction set.

So add add a simple forwarder in arm instruction set which then jumps
to the 'real' entry.

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>


This looks like a special case of what we're doing in f99993c10882 and
dc89c6fb778e and perhaps we need to move that kind of fixup around to
somewhere else, as I assume you've found this problem on a custom
application?  Or are you utilizing hello_world in some test suites?
Just curious, thanks!


I guess the difference to f99993c10882 and dc89c6fb778e is that one
knows from armv7m that the CPU is thumb only while on an armv7a
potentially both arm and thumb mode can be used.

Actually a customer asked how to run hello_world.bin, so I
tested with our regular defconfig and the produced hello_world.bin.

I'm having 'CONFIG_SYS_THUMB_BUILD=y' in e.g.
configs/colibri_imx6_nospl_defconfig thus all of the U-Boot code
including hello_world.c is compiled for thumb.

If I boot that U-Boot, load hello_world.bin into RAM at
CONFIG_STANDALONE_LOAD_ADDR and execute 'go CONFIG_STANDALONE_LOAD_ADDR'
I get output from the go command and then the CPU resets.

    Colibri iMX6 # tftp 0x12000000 hello_world.bin
      ...
    Colibri iMX6 # go 0x12000000                                                     
    ## Starting application at 0x12000000 ...                                       

With the patch I get the expected output.

But actually calling the 'go' command with bit 0 set works. So if
the user knows that he is having a thumb binary that would fix
the issue as well. With the current implementation the following works:

    Colibri iMX6 # go 0x12000001                                                    
    ## Starting application at 0x12000001 ...                                       
    Example expects ABI version 9                                                   
    Actual U-Boot ABI version 9                                                     
    Hello World                                                                     
    argc = 1                                                                        
    argv[0] = "0x12000001"                                                          
    argv[1] = "<NULL>"                                                              
    Hit any key to exit ...                                                         

Max

  reply	other threads:[~2017-08-15 12:24 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-12  9:03 [U-Boot] [PATCH 0/2] improve hello_world standalone application for arm Max Krummenacher
2017-08-12  9:03 ` [U-Boot] [PATCH 1/2] arm: use $loadaddr as the standalone entry point Max Krummenacher
2017-08-12 18:29   ` Wolfgang Denk
2017-08-12 21:21     ` Max Krummenacher
2017-08-14 19:36       ` Wolfgang Denk
2017-08-14 21:13         ` Tom Rini
2017-08-15  7:32           ` Wolfgang Denk
2017-08-15 11:39             ` Tom Rini
2017-08-15 12:22               ` Max Krummenacher
2017-08-15 13:31                 ` Wolfgang Denk
2017-08-15 13:21               ` Wolfgang Denk
2017-08-19  1:35                 ` Tom Rini
2017-08-12  9:03 ` [U-Boot] [PATCH 2/2] hello_world.c: fix entry point in case of arm thumb binary Max Krummenacher
2017-08-12 18:39   ` Wolfgang Denk
2017-08-12 21:31     ` Max Krummenacher
2017-08-14 19:46       ` Wolfgang Denk
2017-08-14 21:15   ` Tom Rini
2017-08-15 12:24     ` Max Krummenacher [this message]
2017-08-12 18:32 ` [U-Boot] [PATCH 0/2] improve hello_world standalone application for arm Wolfgang Denk
2017-08-12 21:21   ` Max Krummenacher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1502799881.3076.18.camel@gmail.com \
    --to=max.oss.09@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox