bk3231s_jlink.ini 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. FUNC void flash_init (void) {
  2. unsigned int reg_val;
  3. // flash data to CPU CRC disable
  4. _WDWORD(0x0082001c, (_RDWORD(0x0082001c))&(~(1<<26)));
  5. // flash status register data to be written
  6. _WDWORD(0x0082001c, (_RDWORD(0x0082001c))&(~(0xffff<<10)));
  7. // cpu data writting enable
  8. _WDWORD(0x0082001c, (_RDWORD(0x0082001c))|(1<<9));
  9. // flash operation command : WRSR2
  10. reg_val = _RDWORD(0x00820000);
  11. reg_val &= (~(0x1f<<24)); // clr op_type_sw
  12. reg_val |= (0x07<<24) | (1<<29) | (1<<30); // op_sw, wp_value
  13. _WDWORD(0x00820000, reg_val);
  14. _sleep_(1000);
  15. while(_RDWORD(0x00820000) & (0x01<<31)){;}
  16. // flash operation command : CE
  17. reg_val = _RDWORD(0x00820000);
  18. reg_val &= (~(0x1f<<24)); // clr op_type_sw
  19. reg_val |= (0x10<<24) | (1<<29) | (1<<30); // op_sw, wp_value
  20. _WDWORD(0x00820000, reg_val);
  21. _sleep_(10000);
  22. while(_RDWORD(0x00820000) & (0x01<<31)){;}
  23. }
  24. flash_init();
  25. LOAD ./obj/BK3231S_Test_Firmware.axf INCREMENTAL
  26. //LOAD ./obj/BK3231S_Test_Firmware.axf NOCODE