From mboxrd@z Thu Jan 1 00:00:00 1970 From: Max Krummenacher Date: Sat, 12 Aug 2017 23:31:55 +0200 Subject: [U-Boot] [PATCH 2/2] hello_world.c: fix entry point in case of arm thumb binary In-Reply-To: <20170812183930.23BBC120207@gemini.denx.de> References: <20170812090346.7887-1-max.krummenacher@toradex.com> <20170812090346.7887-3-max.krummenacher@toradex.com> <20170812183930.23BBC120207@gemini.denx.de> Message-ID: <1502573515.17070.20.camel@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: u-boot@lists.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 > > Best regards, > > Wolfgang Denk >