1,启动流程: bootload->main(8710SDK)->aosmaintask->application->application_start 创建项目出现如下错误: aos create project -b esp8266 -t blink_demo -d tmp blinkapp
[AliOS-Things] ERROR: "python" returned error code 1.
[AliOS-Things] ERROR: Command "python /home/xy/AliOS-Things/build/scripts/gen_newproject.py
解决方法: https://blog.csdn.net/weixin_43869959/article/details/108561927
root@tianmao-virtual-machine:/# aos create project -b esp8266 -t blink_demo -d tmp blinkapp
Creating /tmp/blinkapp/.defconfig ...
Creating /tmp/blinkapp/.config ...
#
# configuration written to /tmp/blinkapp/.config
#
Checking config output: /tmp/blinkapp/.config ...
tmp目录下有blinkapp工程。
root@tianmao-virtual-machine:/tmp/blinkapp
aos_config.h autobuild.json board k_app_config.h out
aos.mk blink_demo.c Config.in maintask.c README.md
2,开发板点灯程序编写 一款方便阅读代码的工具 —source insight,使用方法如下: https://www.cnblogs.com/andy-songwei/p/9965714.html
按mk3080开发板LED灯IO口进行配置 编写blink_demo.c如下:
#include <stdio.h>
#include "aos/kernel.h"
#include "ulog/ulog.h"
#include "board.h"
#include "aos/hal/gpio.h"
#ifdef LED1
#define GPIO_LED_IO LED1
#elif LED2
#define GPIO_LED_IO LED2
#elif LED3
#define GPIO_LED_IO LED3
#elif LED4
#define GPIO_LED_IO LED4
#else
#define GPIO_LED_IO 0xffff
#endif
#define GPIO_RED_LED 0
#define GPIO_GREEN_LED 1
#define GPIO_BLUE_LED 6
gpio_dev_t led_red;
gpio_dev_t led_green;
gpio_dev_t led_blue;
int application_start(int argc, char *argv[])
{
led_red.port = GPIO_RED_LED;
led_green.port = GPIO_GREEN_LED;
led_blue.port = GPIO_BLUE_LED;
led_red.config = OUTPUT_PUSH_PULL;
led_green.config = OUTPUT_PUSH_PULL;
led_blue.config = OUTPUT_PUSH_PULL;
hal_gpio_init(&led_red);
hal_gpio_init(&led_green);
hal_gpio_init(&led_blue);
sys_itag_off();
while (1)
{
aos_msleep(1000);
printf(" toggle led \n");
hal_gpio_output_toggle(&led_red);
hal_gpio_output_toggle(&led_green);
hal_gpio_output_toggle(&led_blue);
}
return 0;
}
aos make 编译完成:
Making blinkappc@esp8266.hex
Making blinkappc@esp8266.bin
AOS MEMORY MAP
|=================================================================|
| MODULE | ROM | RAM |
|=================================================================|
| app_adapter | 76 | 12 |
| arch_xtensa_lx106 | 2662 | 2784 |
| blinkappc | 122 | 36 |
| board_esp8266 | 1330 | 44 |
| kernel_init | 112 | 0 |
| kv | 2224 | 24 |
| libcirom | 27509 | 1200 |
| libcrypto | 14512 | 0 |
| libgcc | 2167 | 0 |
| libhal | 37 | 0 |
| liblwip | 30717 | 1596 |
| libmain | 30412 | 708 |
| libnet80211 | 42675 | 3213 |
| libphy | 48158 | 461 |
| libpp | 43992 | 18013 |
| libwpa | 17240 | 626 |
| mcu_esp8266 | 8555 | 559 |
| netmgr | 94 | 8 |
| newlib_stub | 363 | 0 |
| osal_aos | 670 | 0 |
| rhino | 11685 | 3288 |
| ulog | 573 | 7 |
| vfs | 1440 | 1113 |
| yloop | 2002 | 32 |
| *fill* | 2097 | 128 |
|=================================================================|
| TOTAL (bytes) | 291424 | 33852 |
|=================================================================|
Generate standard flash images /tmp/blinkappc/out/blinkappc@esp8266/binary/blinkappc@esp8266.elf
bin crc: 926c7439
Generate Raw OTA image: /tmp/blinkappc/out/blinkappc@esp8266/binary/blinkappc@esp8266_ota.bin ...
Generate Compressed OTA image: /tmp/blinkappc/out/blinkappc@esp8266/binary/blinkappc@esp8266_ota.bin.xz ...
293797
4955a31978ffe74d65f21ae2d7dcc004
196164
47b2e3a4c98f572f26fe25443cf8acf8
Build complete: blinkappc@esp8266
root@tianmao-virtual-machine:/tmp/blinkappc/out/blinkappc@esp8266/binary# 路径下生成
blinkappc@esp8266.bin
使用image tool烧录工具进行烧写: 将 blinkappc@esp8266.bin 拷贝到共享文件夹下 用跳线将PA30(TX2)和GND短接起来。 download–>复位键–>拔掉跳线 ,烧写完后复位一下,看开发板灯的闪烁情况。
3,开发板点灯程序烧写和注意事项
|