From patchwork Sat Aug 12 09:03:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Krummenacher X-Patchwork-Id: 800826 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="PyS6iZKZ"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xTwvQ4Nnqz9t2y for ; Sat, 12 Aug 2017 19:05:38 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 5DBDDC21DA3; Sat, 12 Aug 2017 09:05:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 67FE7C21DF4; Sat, 12 Aug 2017 09:04:49 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6786BC21E07; Sat, 12 Aug 2017 09:04:45 +0000 (UTC) Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by lists.denx.de (Postfix) with ESMTPS id D3B99C21D8C for ; Sat, 12 Aug 2017 09:04:41 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id y206so8829647wmd.5 for ; Sat, 12 Aug 2017 02:04:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NTjB1bfbkoLSUoaoxBE0CsWPVv+DZbDSpp/CwYdT69I=; b=PyS6iZKZ5cnwziMlz9icqNXaAA8G4ldAMvf4wRyW+BdDSHL5RtVHsFozQD15aYADAI KtIaEgKqHgoz88ec6DHT7SiX9CpkLHiGwI8XTxSj6t1OqsY2NmlNkEk2koBK6Cq7mAMq dQC9k9xqhHbZf9Ak0RuneeqSslVsBVlKwJQqxrxkNxihaeCw8K+QT01qlqs8oj8Eo23j MSz6Pa+t1RRqoBkXJRBzultS3hhSmBOhrupIOx2I01HU9g+wbUXH+xJeS0G2aX4uPaXg rBmrEvNCP9yzGjj6e51ypnt4xj6l0p8Mpn3DoR10ek2gs6Nl3I7LIXERUGvF9h38Pqp4 IVeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NTjB1bfbkoLSUoaoxBE0CsWPVv+DZbDSpp/CwYdT69I=; b=Qm2vQkMSQRRzuqZ/VlifuClqNvooo/V60mnF1WQCDlEH6CEX3K7TLxNa5HSTXKHLg8 RqZD6kAAXYxNC0gh8ZZR3hkh/b0VpmR6wrDC9feUj9BLvS0oCYZ+83wKJ8XhPJEqT1er yhaUyR/wRb9inEGxhbxIXRS06pH8rkGboLVXixPb3FZQMiumSHFaW71xYToI/W1lobFO aF+XX7ReoqnM1XClVJKJsOe6QDINBLBPLCixdSWVLf+ljW7NSGZ/0aWe/xHqwXrh0PXX i5gRwI+ENUbC8aWI/tp3FEXogypNTdxNhrGZPUbAZq+Y/UlWQGoCtQlBSF8p9N5qL1dD 7jNw== X-Gm-Message-State: AHYfb5g3xNdW55a+xOW1fGWJkVAjo77DNt5I/saHs0KzPc/HGE27qfqW 1VzmRZJUBzCkPv6K X-Received: by 10.80.179.235 with SMTP id t40mr18849682edd.62.1502528681434; Sat, 12 Aug 2017 02:04:41 -0700 (PDT) Received: from Saturn.local.all (138-14-48-195.pool.dsl-net.ch. [195.48.14.138]) by smtp.gmail.com with ESMTPSA id f11sm2274656ede.57.2017.08.12.02.04.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 12 Aug 2017 02:04:40 -0700 (PDT) From: Max Krummenacher X-Google-Original-From: Max Krummenacher To: u-boot@lists.denx.de Date: Sat, 12 Aug 2017 11:03:46 +0200 Message-Id: <20170812090346.7887-3-max.krummenacher@toradex.com> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20170812090346.7887-1-max.krummenacher@toradex.com> References: <20170812090346.7887-1-max.krummenacher@toradex.com> Cc: Max Krummenacher Subject: [U-Boot] [PATCH 2/2] hello_world.c: fix entry point in case of arm thumb binary X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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 Signed-off-by: Max Krummenacher --- examples/standalone/hello_world.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/examples/standalone/hello_world.c b/examples/standalone/hello_world.c index bd8b392315..0b859ca4bd 100644 --- a/examples/standalone/hello_world.c +++ b/examples/standalone/hello_world.c @@ -8,6 +8,21 @@ #include #include +/* + * Make thumb work by providing a forwarder to the (thumb) entry point + * compiled for arm instruction set. + * Don't compile this for thumb only CPUs. + */ +#if defined(__thumb__) && defined(__ARM_ARCH_ISA_ARM) +void __attribute__((unused)) __attribute__ ((naked)) dummy2(void) +{ +asm volatile( \ +" .code 32\n" \ +" .arm\n" \ +" ldr pc,=hello_world\n"); +} +#endif + int hello_world (int argc, char * const argv[]) { int i;