Bus fault Imprecise error
Dear Sirs,
I want to edit a string, but the system goes to hard fault (bus fault Imprecise error).
Here below the code:
typedef struct CC_PACKED
{
...
const char *name;
...
} _objd;
static const char acName2005_19[] = "Cycle 0 delta stop";
const _objd SDO2005[] =
{....
{0x19, DTYPE_UNSIGNED32, 32, ATYPE_RW | ATYPE_RXPDO, acName2005_19, 0, 0, MAX_U32, 0, &Modbus_register, C_2005_2006_x_R, C_2005_2006_x_W},
};
in a separate function, since the name is const, I transfer the string to the RAM memory and I try to edit it:
const _objd* objd = ....;
char* s;
u8 name_length = strlen(objd->name) + 1;
s = (char*)malloc(name_length);
strcpy(s, (objd + nsub)->name);
the strcpy sends me in hard fault.
Anybody can please help?
