一个类似于Linux的裸机框架,包含OSAL层,项目地址: https://gitee.com/li-shan-asked/ebraid ,编译只需要三步:
1. 安装gcc
2. 安装arm-none-eabi-gcc (>=13.0版本)
3. cd ebraid/source && make f1c100s_defconfig && make && make flash
烧录到Flash后,即可运行,如下
_ _ _ _ _ _ _
| | | | | | | | | | (_) | |
| | | | ___| | ___ ___ _ __ ___ ___ | |_ ___ ___| |__ _ __ __ _ _ __| |
| |/\| |/ _ \ |/ __/ _ \| '_ ` _ \ / _ \ | __/ _ \ / _ \ '_ \| '__/ _` | |/ _` |
\ /\ / __/ | (_| (_) | | | | | | __/ | || (_) | | __/ |_) | | | (_| | | (_| |
\/ \/ \___|_|\___\___/|_| |_| |_|\___| \__\___/ \___|_.__/|_| \__,_|_|\__,_|
操作一个GPIO只需要如下操作:
ret = gpio_request(IO_PE6);
if(ret) {
SYSLOG_ERROR("gpio request failed\n");
return -1;
}
gpio_direction_output(IO_PE6, 0);
申请一个中断只需要如下操作:
ret = gpio_request(IO_PE4);
if(ret) {
SYSLOG_ERROR("gpio request failed\n");
return -1;
}
int irq = gpio_to_irq(IO_PE4, IRQF_EDGE);
if(irq < 0) {
SYSLOG_ERROR("gpio to irq failed\n");
}
irq_request(irq, test_exit_handler, (void*)12456);
irq_enable(irq);
离线