Hello,
I have a problem with the sd_flash_write function. It HardFaults on me and I can't seem to find out why. The Addresses are 4 byte aligned...
The function is called with: err = sd_flash_write(0x34800, 0x20002a50, 1);
If anyone know assembler, maybe this helps?:
133 else if(
0002105a: subs r3, #1
0002105c: cmp r3, #1
0002105e: bls.n 0x21062 <Testing::TerminalCommandHandler(std::string, std::vector<std::string, std::allocator<std::string> >)+230>
00021060: b.n 0x21256 <Testing::TerminalCommandHandler(std::string, std::vector<std::string, std::allocator<std::string> >)+730>
139 err = sd_flash_write(params->dataDestination, params->dataSource, params->dataLength / 4);
>>> 00021062: ldrh r2, [r4, #16]
00021064: ldr r1, [r4, #8]
00021066: lsrs r2, r2, #2
00021068: ldr r0, [r4, #12]
This happens with the "optimize size" (-Os) option in GCC, if I use -o1, everything works, but that could be due to different alignment and some luck, though the destination and source address remain the same.
Here's the version with -O1: 133
else if(
0002490c: subs r3, #1
0002490e: cmp r3, #1
00024910: bhi.n 0x2496c <Testing::TerminalCommandHandler(std::string, std::vector<std::string, std::allocator<std::string> >)+384>
139 err = sd_flash_write(params->dataDestination, params->dataSource, params->dataLength / 4);
>>> 00024912: ldrh r2, [r4, #16]
00024914: lsrs r2, r2, #2
00024916: ldr r0, [r4, #12]
00024918: ldr r1, [r4, #8]
Thanks, Marius