This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

casting pointers

Hello!

I've bumped into the issue with casting...

main.c:
static ble_gap_addr_t addr0;
static uint16_t *p_host0;

int main(void) {
    p_host0 = (void*)&addr0.addr[0];

works fine, but...

beacon.c:
static ble_gap_addr_t addr1;
static uint16_t *p_host1;

void init_beacon(void) {
   p_host1 = (void*)&addr1.addr[0];

hungs in assignment when I call init_beacon() from main()

Where is rake?

Parents
  • I think, its rather a memory alignment issue... when my code runs, addr1.addr has address 0x200029b5 So when I try to initialize a pointer to 32 bit value by ..29b5 an exception seems to happen. I tied to init a pointer by address of addr.add[3] (..29b8) and it works fine. I saw some warnings about such or similar cases in ARM docs, but it was pretty long time ago...

Reply
  • I think, its rather a memory alignment issue... when my code runs, addr1.addr has address 0x200029b5 So when I try to initialize a pointer to 32 bit value by ..29b5 an exception seems to happen. I tied to init a pointer by address of addr.add[3] (..29b8) and it works fine. I saw some warnings about such or similar cases in ARM docs, but it was pretty long time ago...

Children
No Data
Related