public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Oleg Uzenkov <o.uzenkov@unicore.co.ua>
To: Edgar Grimberg <edgar.grimberg@gmail.com>,
	 Rainer Arndt <arndt@ibehs.de>
Cc: eCos Discussion <ecos-discuss@sourceware.org>
Subject: Re: [ECOS] small custom bootloader to start an app stored in flash
Date: Thu, 23 Oct 2014 15:03:00 -0000	[thread overview]
Message-ID: <544918B9.7000601@unicore.co.ua> (raw)
In-Reply-To: <CAPrjMDCdT9ddPowRvQmaKh396tYwt7yWLzKNQB+83Asi0f71jw@mail.gmail.com>

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

  reply	other threads:[~2014-10-23 15:03 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-21  8:27 Oleg Uzenkov
2014-10-21 11:02 ` Gary Thomas
2014-10-21 13:25 ` Edgar Grimberg
     [not found] ` <CAPrjMDAi=cqTSQ-d-c9FF53W-c6=v0j8rzSLQfuTcBQUY43Zpw@mail.gmail.com>
2014-10-22 11:08   ` Oleg Uzenkov
2014-10-22 13:17     ` Edgar Grimberg
2014-10-22 14:40       ` Oleg Uzenkov
2014-10-23  9:55         ` Edgar Grimberg
2014-10-23 12:53           ` Edgar Grimberg
2014-10-23 15:03             ` Oleg Uzenkov [this message]
2014-10-23 19:25               ` Rainer Arndt
2014-10-23 21:21               ` Sergei Gavrikov
2014-10-24  7:44                 ` Oleg Uzenkov
2014-10-24  8:36                   ` Sergei Gavrikov
2014-10-24  9:13                     ` Oleg Uzenkov
2014-10-24  9:13                     ` Sergei Gavrikov
2014-10-22 19:01     ` Rainer Arndt
2014-10-23 11:50       ` Oleg Uzenkov

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=544918B9.7000601@unicore.co.ua \
    --to=o.uzenkov@unicore.co.ua \
    --cc=arndt@ibehs.de \
    --cc=ecos-discuss@sourceware.org \
    --cc=edgar.grimberg@gmail.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).