extended_sram.c 518 B

123456789101112131415161718192021
  1. #include "at32f403a_407.h"
  2. #include "extended_sram.h"
  3. void extend_SRAM(void)
  4. {
  5. // check if RAM has been set to 224K, if not, change EOPB0
  6. if(((USD->eopb0)&0xFF)!=0xFE)
  7. {
  8. // Unlock Option Bytes Program Erase controller
  9. flash_unlock();
  10. // erase user system data bytes
  11. flash_user_system_data_erase();
  12. // Change SRAM size to 224KB
  13. flash_user_system_data_program((uint32_t)&USD->eopb0, 0xFE);
  14. nvic_system_reset();
  15. }
  16. }