Q:We also found the message "Unhandled unaligned access exception"
appears when we load Linux kernel module.
Shall we need to consider the alignment issue in our code or your
compiler will deal with this issue?
A:Andes compiler和x86不同,我們不會自動處理unaligned的情況。
如果您的module是開機之後才insert,有一個可以處理的辦法:
開機之後,在command line裡下這個command,
echo “7” > /proc/cpu/alignment
再insert module
Q:We have tried it, but the message disappears but the following new message "_do_unaligned_access" appears and then the kernel crashes.
Please also refer to the attachment and give us some suggestion.
A: "_do_unaligned_access" 因為在build kernel時,必須要打開unalignment handler。
Build kernel時,在System type->最下方的kernel support unaligned access handling
(請參考下圖,因為我使用cygwin,所以有亂碼)
Attachment:
unaligned.gif [ 26.08 KiB | Viewed 14777 times ]
PS. 編Linux Kernel時要記得加上環境變數
$ export ARCH=nds32 CROSS_COMPILE=nds32le-linux-
這樣子System type的選項才會出現。
詳細的編譯步驟可以看BSP v3.0.0