Environment details:
binutils: 2.18
arm-elf-gcc: 4.2.2
newlib: 1.16.0
Device: AT91SAM7X256
Compiler: IAR and GCC (for ARM)
Problem statement:
-- I am trying to port a code written for an AVR 8 bit controller
compiled for both IAR and GCC (for AVR). This code had an function which
basically writes and reads from FLASH using the keywords provided by IAR
and GCC for FLASH operations.
/*********************************USEFUL
CODE***************************************/
#if defined(_ICCAVR_)
#define FLASH_DECLARE(x) __flash x
#define FLASH_STRING(x) ((__flash const char *)(x))
#define FLASH_STRING_T char const __flash *
#endif
#if defined(_GNUC_)
#define FLASH_DECLARE(x) x __attribute__((_progmem_))
#define FLASH_STRING(x) PSTR(x)
#define FLASH_STRING_T PGM_P
#endif
void assert_test(bool expression, FLASH_STRING_T message, int8_t *file,
uint16_t line)
{
/* This function prints the provided assert message on serial using
UART */
}
#define ASSERT(expr) assert_test(expr, FLASH_STRING( #expr ),
(int8_t*)__FILE__, _LINE_)
void main(void)
{
ASSERT("Some string" == 0);
}
/*********************************USEFUL
CODE***************************************/
-- I am porting the above mentioned code for AT91SAM7X256 for IAR and
GCC both.
Question: Does GCC/IAR provide any way by which i can read and write the
FLASH at run time.