public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: "Philip Soeberg" <ecos@soeberg.net>
To: <ecos-discuss@sources.redhat.com>
Subject: [ECOS] Deciphering ISO C (Chap 6.3.2.3 - Pointers)
Date: Mon, 10 Nov 2003 22:00:00 -0000	[thread overview]
Message-ID: <20031110220000.FMWe8s0Ze789DY2W9egH1y4fyLAGac8Otgl88fQStt8@z> (raw)
In-Reply-To: <1068496486.9906.71.camel@hermes>

Hi,

I'm having weird difficulties with the flash_am29xxxxx.inl file, whereas I
have created this cut-down version of what appears to be my problem:

-------------

The code-example further down was created from analyzing line 216-217 in
file flash_am29xxxxx.inl:
	ROM = (flash_data_t*) CYGNUM_FLASH_BASE;
	f_s1 = FLASH_P2V(ROM+FLASH_Setup_Addr1);

Resulting output after preprocessing is:
    ROM = (flash_data_t*) (0x00000000u);
    f_s1 = ((volatile flash_data_t *) \
		((CYG_ADDRWORD)((CYG_ADDRESS)ROM+(0x555))));

The value in f_s1 must be 0x555 for the AMD chip to work in word mode (as
far as I have read) ... but "diag_printf("%x", f_s1)" yields 0xAAA :(

-------------

I can't seem to find the logic in why this example doesn’t work:

	cyg_uint16* res_16;
	cyg_uint16* p_16;
	cyg_uint16 u_16;

	p_16 = 0x0u;
	u_16 = 0x0u;
	res_16 = (p_16 + 0x555u);

The above code yields res_16 == 0xaaa
I was sort of hoping for 0x555 instead...

Altering the addition line to this:
	res_16 = (cyg_uint16*)(u_16 + 0x555);
corrects the problem... 

why?

The platform is a 32bit.
Trying to decipher the first addition, I get:
	32bit_u = (32bit_u + 32bit_u)
assuming that the pointer “cyg_uint16 *” is 32bit...

-------------

I hope one of you can shed some light to this problem of mine :)

Regards,
-=[ Philip Soeberg ]=-



--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

  reply	other threads:[~2003-11-10 22:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-10 20:28 [ECOS] Building from OS X Rib Rdb
2003-11-10 20:34 ` Gary Thomas
2003-11-10 22:00   ` Philip Soeberg [this message]
     [not found]   ` <E1AJK5Y-0004tk-00@londo.lunn.ch>
2003-11-10 22:16     ` [ECOS] Deciphering ISO C (Chap 6.3.2.3 - Pointers) Andrew Lunn
2003-11-11  0:27   ` [ECOS] Building from OS X Rib Rdb
2003-11-11  0:37     ` Gary Thomas
2003-11-11  0:49       ` Rib Rdb
2003-11-11  1:18         ` Rib Rdb
2003-11-13  9:37 ` [ECOS] " John Dallaway

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=20031110220000.FMWe8s0Ze789DY2W9egH1y4fyLAGac8Otgl88fQStt8@z \
    --to=ecos@soeberg.net \
    --cc=ecos-discuss@sources.redhat.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).