Hello, I've been working on porting a library I wrote some time ago. It's a pretty involved project, but basically I'm stuck because I can't figure out why my mbed just freezes at this point. I am using the mbed NXP LPC1768 and the online compiler.
The code in question is simple:
virtual void Read(uint32_t address,int count,void *buffer){
pc.printf("memory read: 0x%x; count: %i\n",address,count);
for(int i=0;i<count;i++){ //didn't use memcpy because I thought memory alignment may be an issue
pc.printf("buffer: 0x%x; ptr_memory:0x%x\n",buffer,ptr_memory);
((uint8_t*)buffer)[i]=ptr_memory[address]; //freeze up here
}
}
The function is basically called like this:
uint32_t temp=0;
MyClass.Read(0, 4, &temp);
return temp;
ptr_memory is initialized like this:
uint8_t *ptr_memory=(uint8_t*)malloc(32);
I've triple checked all my code, but I can't reproduce this in a simple test case.
Are there any problems that I could have writing to a stack-allocated place like I am? This is the only thing I can think of. I'm not familiar with the low-level portions of ARM and what differences there are between it and the traditional x86.
Does anyone have any ideas?
Also, not sure if it'll help anyone, but the pointer addresses are as so:
buffer: 0x10007fb0; ptr_memory:0xe600b0
Hello, I've been working on porting a library I wrote some time ago. It's a pretty involved project, but basically I'm stuck because I can't figure out why my mbed just freezes at this point. I am using the mbed NXP LPC1768 and the online compiler.
The code in question is simple:
The function is basically called like this:
ptr_memory is initialized like this:
I've triple checked all my code, but I can't reproduce this in a simple test case.
Are there any problems that I could have writing to a stack-allocated place like I am? This is the only thing I can think of. I'm not familiar with the low-level portions of ARM and what differences there are between it and the traditional x86.
Does anyone have any ideas?
Also, not sure if it'll help anyone, but the pointer addresses are as so: