From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22222 invoked by alias); 23 Oct 2014 15:03:34 -0000 Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Received: (qmail 22203 invoked by uid 89); 23 Oct 2014 15:03:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_SORBS_WEB autolearn=no version=3.3.2 X-HELO: xm21.hostsila.net Received: from xm21.hostsila.net (HELO xm21.hostsila.net) (80.91.189.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 23 Oct 2014 15:03:29 +0000 Received: from [195.20.130.1] (port=61663 helo=[10.1.7.235]) by xm21.hostsila.net with esmtpsa (TLSv1:DHE-RSA-AES128-SHA:128) (Exim 4.82) (envelope-from ) id 1XhJwh-002xHo-S7; Thu, 23 Oct 2014 18:04:59 +0300 Message-ID: <544918B9.7000601@unicore.co.ua> Date: Thu, 23 Oct 2014 15:03:00 -0000 From: Oleg Uzenkov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Edgar Grimberg , Rainer Arndt CC: eCos Discussion References: <544618E5.90101@unicore.co.ua> <54479031.9080106@unicore.co.ua> <5447C1D0.3070906@unicore.co.ua> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Get-Message-Sender-Via: xm21.hostsila.net: authenticated_id: o.uzenkov@unicore.co.ua X-IsSubscribed: yes Subject: Re: [ECOS] small custom bootloader to start an app stored in flash X-SW-Source: 2014-10/txt/msg00041.txt.bz2 Hi again, At last got some progress! :-) The jump from the bootloader now works (but with one minor problem. plz see below) I found that the problem was caused by optimisation. (and it was dumb of me not to pay attention to a warning: optimization may eliminate reads and/or writes to register variables) I should have not used -O option when I use a register variable. Here is bootloader's code: #define HAL_PLF_ARCH_GETRESETVECTOR(__reset,__vector) \ { \ __reset = *((unsigned long*)(__vector+4)); \ register volatile CYG_ADDRESS __stack_ptr asm("sp");\ __stack_ptr = (*((unsigned long*)(__vector))); \ } static volatile unsigned long exec; int main (void) { diag_printf( "JUMP\n" ); HAL_PLF_ARCH_GETRESETVECTOR(exec, 0x08020000); ((void (*)(void))exec)(); while (1); return 0; } Here is app's code: int main (void) { diag_printf( "HELLO1\n" ); diag_printf( "HELLO2\n" ); while (1); return 0; } But there is still some minor problem: Please have a look at the terminal output: JUMPC!▒11=▒ HELLO2 Notice that instead of "HELLO1" a garbage (C!▒11=▒) is printed out. Where as the next HELLO2 is ok. It is either something related to diag_print() that was not initialised properly. or may be something to do with thumb mode on Cortex-4? here: $ arm-none-eabi-nm -n app.elf | grep hal_reset_vsr 08020984 T hal_reset_vsr where as exec is (08020984+1): (gdb) next 28 ((void (*)(void))exec)(); (gdb) print/x exec $3 = 0x8020985 any ideas? Thank you very much for you help!!! Oleg -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss