參考資訊:
https://github.com/jdelphi/nuvoprog2
https://github.com/erincandescent/libn76
https://github.com/erincandescent/nuvoprog
https://cmheong.blogspot.com/2020/07/flashed-before-my-eyes-nuvoton-76n003.html
LED是連接到P1.2
P1M1
main.c
#include <stdint.h> #include <n76e003.h> static void delay(unsigned long cnt) { while (cnt--) { } } void main(void) { P1M1 = 0; while (1) { P12 ^= 1; delay(5000); } }
config.json
{ "boot_select": "aprom", "pwm_enabled_during_ocd": false, "ocd_enabled": true, "reset_pin_disabled": true, "locked": false, "ldrom_size": "0kb", "bod_disabled": false, "bod_voltage": "2v2", "iap_enabled_in_brownout": false, "bod_reset_disabled": false, "wdt": "disabled" }
編譯
$ sdcc main.c -mmcs51 --out-fmt-ihx -o main.ihx
將MCU-003的VCC、DAT、CLK、RST、GND連接到Nu-Link燒錄器
燒錄
$ nuvoprog program -t n76e003 -c @config.json -a main.ihx
完成