Re: C programming on ARM




"Hans-Bernhard Bröker" <HBBroeker@xxxxxxxxxxx> wrote in message news:fnr0vs$mp6$00$1@xxxxxxxxxxxxxxxxxxxx
Wilco Dijkstra wrote:

With any byte addressable architecture, a pointer is just a pointer.

But there are quite a few non-byte addressable architectures out there.
Including ARM, last I checked.

Actually most architectures are byte addressable, including ARM,

Depends on what exactly you mean by the term.

AFAIK ARM7 is byte-addressable only for bytes, but not for larger objects. Well, may be it's just me, but I wouldn't
call what happens when an ARM7 accesses a 32-bit integer without 4-byte alignment "addressing".

Obviously not all possible pointer values are valid for all types. This doesn't
affect byte addressability as casting between char* and int* doesn't lose
information. Accessing a misaligned pointer will result in an exception
(which is a good way to detect corrupted pointers). However if you use
the correct type (eg. __packed int *p rather than int *p), the compiler will
generate an unaligned access.

Similarly a 32-bit CPU with less than 4GB of memory doesn't have
(say) a 18.25-bit address space - it still has a 32-bit address space of
which only a small proportion is valid.

Wilco



.



Relevant Pages

  • [regression] jffs2 gc thread oops in set_dumpable()
    ... The following crash has been observed on an ARM platform ... and an AVR32 platform. ... In both cases, it's a NULL pointer ... Unable to handle kernel NULL pointer dereference at virtual address 00000150 ...
    (Linux-Kernel)
  • Re: replace polling with interrupt
    ... communicates with the ARM using the i2c driver. ... enable a tx-buffer-empty interrupt ... send the first character, increment the pointer ... increment the pointer, else disable the interrupt ...
    (comp.arch.embedded)
  • Re: Does an array of char have alignment issues?
    ... it only has to run on an ARM, so I can live with a solution that is true for the ARM, even if not guaranteed by the C standard. ... am I certain that an array of char will not have padding bytes between the array elements? ... pointer to type T, ... If you have charstarting at the address non-32bit-aligned, the gcc's memcpy with e.g. -O2 would certainly fail since the memcpy macro copies memory region as series of 32bit integers. ...
    (comp.sys.arm)
  • re: Linux 2.6.30-rc2: [PATCH] ARM OABI compatibility: fix build error
    ... identifier is reported only once ... pointer from integer without a cast ... ARM: Fix build error when CONFIG_OABI_COMPAT is selected ...
    (Linux-Kernel)