Programm memory reading

int EEReadB(int ADR){
return (volatile uint32_t)((unsigned int)(ADR)); //Read data from Flash Memory
}

The device halted when executing this code. Even Arduino works with this code.
How can I read programm memory from device?