Hi, Captain,
Regarding your question, I think the code is incorrect.
for(unsigned int i=0; i<num; i++)
{
volatile unsigned int Add=0x1c00_0000+i;
volatile unsigned char data=*(ptr+i);
__asm("NOP");
*(volatile uint32_t *)Add=data;
}
for the *(volatile uint32_t *)Add=data; because the Add address is uint_32 type, the Add address can be 0x1c00_0000; 0x1c00_0004; 0x1c00_0008; 0x1c00_000C; but it can not be 0x1c00_0001;0x1c00_0002; 0x1c00_0003, otherwise, unalignment error will happen.
You can use the code like:
uint32_t temp;
unsigned char c0,c1,c2,c3;
for(unsigned int i=0; i<num/4; i+4)
{
volatile unsigned int Add=0x1c00_0000+i;
c0=*(ptr+i);
c1=*(ptr+i+1);
c2=*(ptr+i+2);
c3=*(ptr+i+3);
temp=c3<<24|c2<<16|c1<<8|c0;
__asm("NOP");
*(volatile uint32_t *)Add=temp;
}
Pls have a try.
Hope it can help you
BR
XiangJun Rong