Alignment

General discussion on mikroBasic PRO for dsPIC30/33 and PIC24.
Post Reply
Author
Message
arco
Posts: 312
Joined: 15 Apr 2008 13:54
Location: The Netherlands

Alignment

#1 Post by arco » 13 Oct 2018 13:43

How do I force the compiler to create all arrays word-aligned?
It now sometimes creates char arrays on odd boundaries which is very cumbersome for access with pointers.
(giving an address trap error). If (d)word-aligned I can use:

Code: Select all

  dwPtr = @SD_Data[454]      BootRecordSector = dwPtr^      
With unaligned arrays I need to copy byte-by-byte:

Code: Select all

  Lo(BootRecordSector)      = SD_Data[454]         
  Hi(BootRecordSector)      = SD_Data[455]         
  Higher(BootRecordSector)  = SD_Data[456]         
  Highest(BootRecordSector) = SD_Data[457]         
Regards,

Peter.

Post Reply

Return to “mikroBasic PRO for dsPIC30/33 and PIC24 General”