Forum Discussion
naand
New Contributor
1 year agoHi,
I'm using the Micron Flash MT25QL256ABA8E12-1SIT.
I tried the solution proposed in the StackOverflow link: the __attribute__ ((noinline)) works, so this is another solution.
My problem is only with the optimization of the flash_read_flag_status_register function, so this is my example of the #pragma directive:
#pragma GCC push_options
#pragma GCC optimize("O0")
alt_u32 flash_read_flag_status_register(T_flash_state *st)
{
IOWR(st->csr_base, FLASH_CSR_FL_CMD_SET, 0x00001870);
IOWR(st->csr_base, FLASH_CSR_FL_CMD_CTRL, 0x1);
return IORD(st->csr_base, FLASH_CSR_FL_CMD_RD0);
}
#pragma GCC pop_options
My code works even with the highest level of GCC optimization (-O3) if I use the #pragma solution.
Thanks.
Best Regards,
naand