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: Sat, 12 Aug 2017 23:31:55 +0200	[thread overview]
Message-ID: <1502573515.17070.20.camel@gmail.com> (raw)
In-Reply-To: <20170812183930.23BBC120207@gemini.denx.de>

Dear Wolfgang

Am Samstag, den 12.08.2017, 20:39 +0200 schrieb Wolfgang Denk:
> Dear Max,
> 
> In message <20170812090346.7887-3-max.krummenacher@toradex.com> you 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.
> 
> This description makes no sense to me.  Whatever you do, the address
> where the image starts executuin is what is called the entry point.
> Whether this is needs special code to swutch to thumb mode or not
> does not make any difference.  Whichever address you use with the
> "go" command is the "entry point".
> 
> Also, can the mode switching not be done inside the body of the
> regular hello_world() function?  This would be much better as it
> wuld allow to always use the same method to determine the entry
> point address (line running "nm" on the binary and grepping for the
> name "hello_world").  With your code, you would have to fix all
> documentation and explain that the entry pooint name is suddenly
> domething totally different (and an unexpected, unusal name like
> "dummy2" as well) for thumb images.

This again stems from my assumption that one has to write the
standalone application in a way that the entry point is actually
linked to the beginning of the binary.

One cannot put the mode switching from thumb to arm instruction set
inside the body of a C function, as the entry code prepended by
the compiler would be in thumb and thus an exception would occur
before the mode switching code gets executed.

Probably one can add a pragma conditionally so that the entry
function gets compiled in arm instruction set. I investigate
further and send a v2.

Max
> 
> Sorry, but this does not seem a good idea to me.
> 
> Naked-by: Wolfgang Denk <wd@denx.de>
> 
> Best regards,
> 
> Wolfgang Denk
> 

  reply	other threads:[~2017-08-12 21:31 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 [this message]
2017-08-14 19:46       ` Wolfgang Denk
2017-08-14 21:15   ` Tom Rini
2017-08-15 12:24     ` Max Krummenacher
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=1502573515.17070.20.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