extended_sram.c 523 B

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