0xc0170 / kinetis_klxx_gcc

Kinetis L - gpio demo using CMSIS files, ARM GCC
14 stars 7 forks source link

alignment of __bss_end__ #3

Open prof7bit opened 7 years ago

prof7bit commented 7 years ago

I found another alignment problem, this time i was experimenting with the FRDM-KL25z board, I experienced a hardfault whithin the bss zero loop (using a modified startup assembly from freescale with loop to zero the bss) and it was due to a misaligned __bss_end__ symbol.

I have not looked into the other examples, I noticed the MKL26 example does not even use __bss_end__ in the startup but I seem to recall that some others do.

the following patch will fix it:

$ git diff MKL25Z32xxx4.ld
diff --git a/empty_project_frdm_kl25z/kl25_src/MKL25Z32xxx4.ld b/empty_project_frdm_kl25z/kl25_src/MKL25Z32xxx4.ld
index 4beb27f..b3c99a4 100644
--- a/empty_project_frdm_kl25z/kl25_src/MKL25Z32xxx4.ld
+++ b/empty_project_frdm_kl25z/kl25_src/MKL25Z32xxx4.ld
@@ -135,6 +135,7 @@ SECTIONS
         __bss_start__ = .;
         *(.bss*)
         *(COMMON)
+        . = ALIGN(4);
         __bss_end__ = .;
     } > RAM
0xc0170 commented 5 years ago

Hi, I've missed this bug report, sorry about that. I'll check and fix this alignment (feel free to send PR anytime)