Upgrade to Pro — share decks privately, control downloads, hide ads and more …

一夜漬けULP -アセンブラでM5StickCをLチカ- / LED Blink on M5S...

一夜漬けULP -アセンブラでM5StickCをLチカ- / LED Blink on M5StickC(ESP32) using Arduino IDE and ULP Debugger

M5Stackユーザーミーティング vol.7
https://m5stack.connpass.com/event/161858/

コードはESP32 ULP Debuggerのスケッチ例です。
GPIO26とGNDの間にLEDを接続して実行します。

・ブログ
https://lang-ship.com/blog/

・ULPの資料
https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/ulp.html

・一夜漬けCASL
https://www.amazon.co.jp/dp/484431100X

・Arduino IDE+ビルドツール
https://github.com/duff2013/ulptool

・ESP32 ULP Debugger
https://github.com/tanakamasayuki/UlpDebug

TANAKA Masayuki

February 04, 2020
Tweet

More Decks by TANAKA Masayuki

Other Decks in Technology

Transcript

  1. 変数確保(enum) // Slow memory variable assignment enum { SLOW_BLINK_STATE, //

    Blink status SLOW_PROG_ADDR // Program start address };
  2. 初期化 // Slow memory initialization memset(RTC_SLOW_MEM, 0, 8000); // Blink

    status initialization RTC_SLOW_MEM[SLOW_BLINK_STATE] = 0;
  3. ULPプログラム1 const ulp_insn_t ulp_prog[] = { I_MOVI(R3, SLOW_BLINK_STATE), // R3

    = SLOW_BLINK_STATE I_LD(R0, R3, 0), // R0 =MEM[R3] M_BL(1, 1), // IF R0 < 1 THAN GOTO M_LABEL(1)
  4. ULPプログラム2 // R0 < 1 : run M_LABEL(1), // M_LABEL(1)

    I_WR_REG(RTC_GPIO_OUT_REG, pin_blink_bit, pin_blink_bit, 0), // pin_blink_bit = 0 I_MOVI(R0, 1), // R0 = 1 I_ST(R0, R3, 0), // MEM[R3] = R0
  5. ULPプログラム3 I_DELAY(60000), I_DELAY(60000), I_DELAY(60000), I_DELAY(60000), I_DELAY(60000), I_DELAY(60000), I_DELAY(60000), I_DELAY(60000), I_DELAY(60000),

    I_DELAY(60000), I_DELAY(60000), I_DELAY(60000), I_DELAY(60000), I_DELAY(60000), I_HALT() // Stop the program