等了一周终于到了
先来个证件照
接下来点灯!!!
翻了翻SDK里的demo aithinker_Ai-M6X_SDK\examples\peripherals\gpio\gpio_input_output 这个是可以控制RGB灯。
按照原理图修改源码
- #include "bflb_gpio.h"
- #include "board.h"
- struct bflb_device_s *gpio;
- int main(void)
- {
- board_init();
- gpio = bflb_device_get_by_name("gpio");
- printf("gpio output\r\n");
- bflb_gpio_init(gpio, GPIO_PIN_15, GPIO_OUTPUT | GPIO_PULLUP | GPIO_SMT_EN | GPIO_DRV_0);
- bflb_gpio_init(gpio, GPIO_PIN_12, GPIO_OUTPUT | GPIO_PULLUP | GPIO_SMT_EN | GPIO_DRV_0);
- bflb_gpio_init(gpio, GPIO_PIN_13, GPIO_OUTPUT | GPIO_PULLUP | GPIO_SMT_EN | GPIO_DRV_0);
- bflb_gpio_init(gpio, GPIO_PIN_27, GPIO_OUTPUT | GPIO_PULLUP | GPIO_SMT_EN | GPIO_DRV_0);
- bflb_gpio_set(gpio, GPIO_PIN_27);
- while (1) {
- bflb_gpio_set(gpio, GPIO_PIN_12);
- bflb_gpio_set(gpio, GPIO_PIN_15);
- bflb_gpio_set(gpio, GPIO_PIN_14);
-
- bflb_mtimer_delay_ms(200);
- bflb_gpio_reset(gpio, GPIO_PIN_15);
- bflb_gpio_reset(gpio, GPIO_PIN_12);
- bflb_gpio_reset(gpio, GPIO_PIN_14);
- bflb_mtimer_delay_ms(200);
- }
- }
复制代码
按住boot插电进入下载模式,直接干进去
- PS E:\MicroPython\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\examples\peripherals\gpio\gpio_input_output> make flash CHIP=bl616 COMX=COM7
- ./../../../../tools/cmake/bin/cmake.exe -S . -B build -G "MinGW Makefiles" -DCROSS_COMPILE=riscv64-unknown-elf- -DCHIP=bl616 -DCPU_ID= -DBOARD=bl616dk -DBOARD_DIR= -DCONFIG_DEBUG=y -DCONFIG_ROMAPI=y -DCONFIG_USB_HS=y -DCONFIG_COMX=COM7 -DCMAKE_EXPORT_COMPILE_COMMANDS=OFF -DCONFIG_TLSF=y
- -- [register library : libc], path:E:/MicroPython/AiPi-Open-Kits/aithinker_Ai-M6X_SDK/components/libc
- -- [register library : mm], path:E:/MicroPython/AiPi-Open-Kits/aithinker_Ai-M6X_SDK/components/mm
- -- [register library : utils], path:E:/MicroPython/AiPi-Open-Kits/aithinker_Ai-M6X_SDK/components/utils
- -- [register library : lhal], path:E:/MicroPython/AiPi-Open-Kits/aithinker_Ai-M6X_SDK/drivers/lhal
- -- [register extern library : libcsi_xt900p32f_dsp], path:E:/MicroPython/AiPi-Open-Kits/aithinker_Ai-M6X_SDK/drivers/lhal
- -- [register extern library : libpka], path:E:/MicroPython/AiPi-Open-Kits/aithinker_Ai-M6X_SDK/drivers/lhal
- -- [register library : std], path:E:/MicroPython/AiPi-Open-Kits/aithinker_Ai-M6X_SDK/drivers/soc/bl616/std
- -- Configuring done
- -- Generating done
- -- Build files have been written to: E:/MicroPython/AiPi-Open-Kits/aithinker_Ai-M6X_SDK/examples/peripherals/gpio/gpio_input_output/build
- make -C build -j8
- [ 2%] Built target app
- [ 7%] Built target utils
- [ 21%] Built target std
- [ 24%] Built target mm
- [ 66%] Built target libc
- [ 98%] Built target lhal
- [ 99%] Building C object CMakeFiles/gpio_input_output_bl616.elf.dir/main.c.obj
- [100%] Linking C executable build_out\gpio_input_output_bl616.elf
- Generate E:/MicroPython/AiPi-Open-Kits/aithinker_Ai-M6X_SDK/examples/peripherals/gpio/gpio_input_output/build/build_out/gpio_input_output_bl616.bin
- [100%] Built target gpio_input_output_bl616.elf
- make -C build combine
- [20:02:42.085] - bflb firmware post process : V1.2.0
- [20:02:42.086] - Chipname: bl616
- [20:02:42.086] - Board config dir: ./../../../../bsp/board/bl616dk/config
- [20:02:42.087] - Create partition using partition_cfg_4M.toml
- [20:02:42.090] - Create dts for E:\MicroPython\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\examples\peripherals\gpio\gpio_input_output\build\build_out\gpio_input_output_bl616.bin
- [20:02:42.090] - Create dts using bl_factory_params_IoTKitA_auto.dts
- [20:02:42.095] - 4K header found,append dts file
- [20:02:42.096] - Copy boot2_bl616_release_v8.0.8.bin
- [20:02:42.097] - Copy mfg_bl616_gu_af8b0946f_v2.26.bin
- [20:02:42.099] - Create dts for E:\MicroPython\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\examples\peripherals\gpio\gpio_input_output\build\build_out\mfg_bl616_gu_af8b0946f_v2.26.bin
- [20:02:42.099] - Create dts using bl_factory_params_IoTKitA_auto.dts
- [20:02:42.108] - 4K header found,append dts file
- [20:02:42.109] -
- Process E:\MicroPython\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\examples\peripherals\gpio\gpio_input_output\build\build_out\gpio_input_output_bl616.bin
- [20:02:42.146] - ========= sp image create =========
- [20:02:42.146] - Flash config crc: b'b5fec518'
- [20:02:42.147] - Clock config crc: b'4a05f490'
- [20:02:42.147] - Image Offset:0x1000
- [20:02:42.147] - Image hash is b'6cfa14b98db277adb0a825571116ecc1f8a15db76471c98d12a142adeb3cc02e'
- [20:02:42.148] - Encrypt efuse data
- [20:02:42.151] - Image Offset:0x1000
- [20:02:42.151] - Image hash ignore,not calculate
- [20:02:42.151] - Bootheader config crc: b'8baad76b'
- [20:02:42.152] -
- Process E:\MicroPython\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\examples\peripherals\gpio\gpio_input_output\build\build_out\boot2_bl616_release_v8.0.8.bin
- [20:02:42.153] - ========= sp image create =========
- [20:02:42.154] - Flash config crc: b'b5fec518'
- [20:02:42.154] - Clock config crc: b'4a05f490'
- [20:02:42.155] - Image Offset:0x2000
- [20:02:42.155] - Image hash is b'4f4eecaddc6e597708f626253879f5560534d2e3baff848f4d96fabbce4b020f'
- [20:02:42.155] - Encrypt efuse data
- [20:02:42.156] - Image Offset:0x2000
- [20:02:42.156] - Image hash ignore,not calculate
- [20:02:42.157] - Bootheader config crc: b'ccbfa125'
- [20:02:42.157] -
- Process E:\MicroPython\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\examples\peripherals\gpio\gpio_input_output\build\build_out\mfg_bl616_gu_af8b0946f_v2.26.bin
- [20:02:42.158] - ========= sp image create =========
- [20:02:42.159] - Flash config crc: b'4fb1fe70'
- [20:02:42.159] - Clock config crc: b'0b34ef89'
- [20:02:42.159] - Image Offset:0x1000
- [20:02:42.161] - Image hash is b'69de5b7af45fea2e456fb6864612126bbdad58e69294d1466a2f892e010d1f3d'
- [20:02:42.162] - Encrypt efuse data
- [20:02:42.163] - Image Offset:0x1000
- [20:02:42.164] - Bootheader config crc: b'f9cf01e0'
- [20:02:42.165] - create OTA file:E:\MicroPython\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\examples\peripherals\gpio\gpio_input_output\build\build_out\gpio_input_output_bl616.bin.ota
- [20:02:42.169] - create XZ file:E:\MicroPython\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\examples\peripherals\gpio\gpio_input_output\build\build_out\gpio_input_output_bl616.xz
- [20:02:42.187] - create XZ OTA file:E:\MicroPython\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\examples\peripherals\gpio\gpio_input_output\build\build_out\gpio_input_output_bl616.xz.ota
- Built target combine
- ./../../../../tools/bflb_tools/bouffalo_flash_cube/BLFlashCommand.exe --interface=uart --baudrate=2000000 --port=COM7 --chipname=bl616 --cpu_id= --config=flash_prog_cfg.ini
- ['./../../../../tools/bflb_tools/bouffalo_flash_cube/BLFlashCommand.exe', '--interface=uart', '--baudrate=2000000', '--port=COM7', '--chipname=bl616', '--cpu_id=', '--config=flash_prog_cfg.ini']
- [20:02:43.998] - Serial port is COM7
- [20:02:43.999] - ==================================================
- [20:02:44.003] - Program Start
- [20:02:44.004] - ========= eflash loader cmd arguments =========
- [20:02:44.005] - serial port is COM7
- [20:02:44.005] - chiptype: bl616
- [20:02:44.005] - cpu_reset=False
- [20:02:44.030] - ========= Interface is uart =========
- [20:02:44.030] - Bootrom load
- [20:02:44.030] - ========= get_boot_info =========
- [20:02:44.031] - ========= image get bootinfo =========
- [20:02:44.317] - tx rx and power off, press the machine!
- [20:02:44.317] - cutoff time is 0.05
- [20:02:44.380] - power on tx and rx
- [20:02:45.384] - reset cnt: 0, reset hold: 0.05, shake hand delay: 0.1
- [20:02:45.384] - clean buf
- [20:02:45.391] - send sync
- [20:02:45.634] - ack is b'4f4b464c0201'
- [20:02:45.682] - shake hand success
- [20:02:46.185] - data read is b'0100160600000100271289011b032bcf0eb499000f758010'
- [20:02:46.185] - ========= ChipID: b40ecf2b031b =========
- [20:02:46.186] - Get bootinfo time cost(ms): 2154.61376953125
- [20:02:46.186] - change bdrate: 2000000
- [20:02:46.186] - Clock PLL set
- [20:02:46.188] - Set clock time cost(ms): 2.011962890625
- [20:02:46.323] - Read mac addr
- [20:02:46.325] - flash set para
- [20:02:46.325] - get flash pin cfg from bootinfo: 0x24
- [20:02:46.325] - set flash cfg: 14124
- [20:02:46.325] - Set flash config
- [20:02:46.329] - Set para time cost(ms): 2.103759765625
- [20:02:46.329] - ========= flash read jedec ID =========
- [20:02:46.331] - Read flash jedec ID
- [20:02:46.331] - readdata:
- [20:02:46.331] - b'5e401700'
- [20:02:46.331] - Finished
- [20:02:46.334] - Program operation
- [20:02:46.335] - Dealing Index 0
- [20:02:46.335] - ========= programming E:\MicroPython\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\examples\peripherals\gpio\gpio_input_output\.\build\build_out\gpio_input_output_bl616.bin to 0x000000
- [20:02:46.337] - flash para file: E:\MicroPython\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\tools\bflb_tools\bouffalo_flash_cube\chips/bl616/efuse_bootheader/flash_para.bin
- [20:02:46.338] - Set flash config
- [20:02:46.342] - Set para time cost(ms): 2.9921875
- [20:02:46.343] - ========= flash load =========
- [20:02:46.344] - ========= flash erase =========
- [20:02:46.344] - Erase flash from 0x0 to 0x7d5f
- [20:02:46.512] - Erase time cost(ms): 168.134765625
- [20:02:46.531] - Load 2048/32096 {"progress":6}
- [20:02:46.547] - Load 4096/32096 {"progress":12}
- [20:02:46.562] - Load 6144/32096 {"progress":19}
- [20:02:46.578] - Load 8192/32096 {"progress":25}
- [20:02:46.594] - Load 10240/32096 {"progress":31}
- [20:02:46.608] - Load 12288/32096 {"progress":38}
- [20:02:46.624] - Load 14336/32096 {"progress":44}
- [20:02:46.640] - Load 16384/32096 {"progress":51}
- [20:02:46.656] - Load 18432/32096 {"progress":57}
- [20:02:46.672] - Load 20480/32096 {"progress":63}
- [20:02:46.687] - Load 22528/32096 {"progress":70}
- [20:02:46.703] - Load 24576/32096 {"progress":76}
- [20:02:46.718] - Load 26624/32096 {"progress":82}
- [20:02:46.734] - Load 28672/32096 {"progress":89}
- [20:02:46.750] - Load 30720/32096 {"progress":95}
- [20:02:46.761] - Load 32096/32096 {"progress":100}
- [20:02:46.761] - Load 32096/32096 {"progress":100}
- [20:02:46.761] - Write check
- [20:02:46.768] - Flash load time cost(ms): 252.438232421875
- [20:02:46.768] - Finished
- [20:02:46.769] - Sha caled by host: b0dc271545d75d01b89b6e4c12227b20b5158c1ac24b9e215f36a2367306c015
- [20:02:46.769] - xip mode Verify
- [20:02:46.800] - Read Sha256/32096
- [20:02:46.800] - Flash xip readsha time cost(ms): 28.760986328125
- [20:02:46.801] - Finished
- [20:02:46.803] - Sha caled by dev: b0dc271545d75d01b89b6e4c12227b20b5158c1ac24b9e215f36a2367306c015
- [20:02:46.803] - Verify success
- [20:02:46.806] - Program Finished
- [20:02:46.806] - All time cost(ms): 2803.04443359375
- [20:02:46.920] - close interface
- [20:02:46.920] - [All Success]
复制代码
按下reset 完全OJBK
|
|