环境

官方文档:https://www.embedthis.com/goahead/doc/

源码下载: goahead-4.1.0-src.tgz

系统平台:Ubuntu 12.04.4

gcc version 4.6.3

移植步骤

1.解压与编译

前提:交叉编译工具 arm-none-linux-gnueabi-gcc 已经安装并配置了环境变量;

tar -zxvf goahead-4.1.-src.tgz
cd goahead-4.1.0
// 交叉编译
make CC=arm-none-linux-gnueabi-gcc ARCH=arm

编译之后在 goahead-4.1.0/build  目录下生成了  linux-arm-default 文件夹

里面包含我们需要的 goahead 可执行文件和 库

2.开始测试

新建一个 goahead 文件夹,可nfs挂载,我们使用nfs挂载调试

将 goahead-4.1.0/build/linux-arm-default/bin 里面的  goahead  libgo.so 拷贝到 goahead 文件夹

目标arm板开启 mount 挂载

cd /mnt/goahead

// 运行测试

./goahead -v ./web/  192.168.10.111:80

这里出现不能获取本地IP地址

解决方案一:

修改源码 goahead-4.1.0/src/http.c

#else
{
#if 0
struct hostent *hp;
if ((hp = gethostbyname(host)) == NULL) {
error("Cannot get host address for host %s: errno %d", host, errno);
return -;
}
memcpy((char*) &intaddr, (char *) hp->h_addr_list[], (size_t) hp->h_length);
ipaddr = inet_ntoa(intaddr);
#else // wangh 2019-6-4 换种方式获取ip地址 (ipv4)
int sockfd;
struct sockaddr_in sin;
struct ifreq ifr;
sockfd = socket(AF_INET, SOCK_DGRAM, );
if (sockfd == -)
{
return -;
}
strncpy(ifr.ifr_name, "eth0", IFNAMSIZ); //网卡多的得修改下
ifr.ifr_name[IFNAMSIZ - ] = ;
if (ioctl(sockfd, SIOCGIFADDR, &ifr) < )
{
return -;
}
memcpy(&sin, &ifr.ifr_addr, sizeof(sin));
ipaddr=inet_ntoa(sin.sin_addr);
#endif
websSetIpAddr(ipaddr);
websSetHost(ipaddr);
}
#endif
return ;
}

修改源码后需重新编译,并重新将 goahead-4.1.0/build/linux-arm-default/bin 里面的  goahead  libgo.so 拷贝到 goahead 文件夹

再测试

拷贝 build/linux-arm-default/bin/self.crt  self.key  到 goahead

测试发现 不能打开 route.txt

拷贝 goahead-4.1.0/src/route.txt  到 goahead

拷贝 goahead-4.1.0/src/auth.txt  到 goahead

这里说明移植运行成功

再浏览器输入 目标板主机地址 192.168.1.124

这是因为网页的内容还没有添加

3 web内容添加

再 goahead 文件夹下 新建 web 文件夹

编写 测试 首页

<html>
<!- Copyright (C) HTGD Co.,Ltd. 2019 All Rights Reserved. ->
<head> <!- 文档包含的元数据 ->
<title>M283 Web Application</title> <!- 文档标题 ->
<meta charset="UTF-8"> <!- 中文编码 ->
<link rel="stylesheet" href="style/normal_ws.css" type="text/css">
</head>
<body> <!- 元素包含了可见的页面内容 ->
<h1>M283 Web Application</h1> <!- 一级标题 ->
<h2>The Simplified I/O Device Control</h2> <!- 二级标题 ->
<form id="gpio-2-4" action="/goform/gpio_p24" method="post">
<input type="hidden" name="lab_gpio_p2.4" value="gpio-p2.4" />
<table border="0">
<tr>
<td width=100><b>DeviceName </b></td>
<td width=100><b>Direction </b></td>
<td width=100><b>Value </b></td>
<td width=100><b>Setting</b></td>
</tr>
<tr>
<td width=100> Gpio P2.4 </td>
<td width=100>
<input type="checkbox" name="dir24" title="out" />out</td>
<td width=100>
<input type="checkbox" name="val24" /></td>
<td width=100><input type="submit" value="set" /></td>
</tr>
</table>
</form>
<form id="gpio-2-5" action="/goform/gpio_p25" method="post">
<input type="hidden" name="lab_gpio_p2.5" value="gpio-p2.5" />
<table>
<tr>
<td width=100>
Gpio P2.5</td>
<td width=100>
<input type="checkbox" name="dir25" title="out" />out</td>
<td width=100>
<input type="checkbox" name="val25" /></td>
<td width=100><input type="submit" value="set" /></td>
</tr>
</table>
</form>
<form id="gpio-2-6" action="/goform/gpio_p26" method="post">
<input type="hidden" name="lab_gpio_p2.6" value="gpio-p2.6" />
<table>
<tr>
<td width=100>
Gpio P2.6</td>
<td width=100>
<input type="checkbox" name="dir26" title="out" />out</td>
<td width=100>
<input type="checkbox" name="val26" /></td>
<td width=100><input type="submit" value="set" /></td>
</tr>
</table>
</form>
<form id="gpio-2-7" action="/goform/gpio_p27" method="post">
<input type="hidden" name="lab_gpio_p2.7" value="gpio-p2.7" />
<table>
<tr>
<td width=100>
Gpio P2.7</td>
<td width=100>
<input type="checkbox" name="dir27" title="out" />out</td>
<td width=100>
<input type="checkbox" name="val27" /></td>
<td width=100><input type="submit" value="set" /></td>
</tr>
</table>
</form>
<form id="gpio-led" action="/goform/led" method="post">
<input type="hidden" name="lab_led" value="led-err" />
<table>
<tr>
<td width=100>
LED-ERR</td>
<td width=100>
<input type="checkbox" name="dir_led" checked disabled title="out" />out</td>
<td width=100>
<input type="checkbox" name="val_led" /></td>
<td width=100><input type="submit" value="set" /></td>
</tr>
</table>
</form>
<form id="gpio-buzzer" action="/goform/buzzer" method="post">
<input type="hidden" name="lab_buzzer" value="buzzer" />
<table>
<tr>
<td width=100>
BUZZER</td>
<td width=100>
<input type="checkbox" name="dir_buz" checked disabled title="out" />out</td>
<td width=100>
<input type="checkbox" name="val_buz" /></td>
<td width=100><input type="submit" value="set" /></td>
</tr>
</table>
</form> <p> <!- 元素定义一个段落 ->
About the GPIO P2.4(,5,6,7), we assume the pin(s) are exported previously<br />
and they can work as GPIO.<br /><br />
The buzzer must connect JP1(BZ) on the board, else it does not buzze<br />
when the control signal is valid.
</p>
<h2>
System LCD Backlight Control</h2>
<form id="lcdbkl" action="/goform/lcdbkl" method="post">
<input type="hidden" name="lab_bkl" value="lab_bkl" />
<table>
<tr>
<td><b>backlight(0-100): </b></td>
<td><input type="text" name="bkl_val" value="80" size="3" maxlength="3" />%</td>
<td><input type="submit" name="lcd_bk" value="set"/></td>
</tr>
</table>
<hr/>
<p align="center"><b> &copy; 2019 HTGD Co.,Ltd.</b> <a href="http://www.htgd.com.cn">公司主页</a></p>
</body>
</html>

然后执行 ./goahead -v ./web/

默认打开 index.html  其他页面直接写名称

GoAhead4.1.0 开发总结一(移植)的更多相关文章

  1. GoAhead4.1.0 开发总结二(自定义使用)

    环境 官方文档:https://www.embedthis.com/goahead/doc/ 源码下载: goahead-4.1.0-src.tgz 系统平台:Ubuntu 12.04.4 gcc v ...

  2. GoAhead4.1.0 开发总结三(GoAction+Ajax实现局部数据交互)

    环境 官方文档:https://www.embedthis.com/goahead/doc/ 源码下载: goahead-4.1.0-src.tgz 系统平台:Ubuntu 12.04.4 gcc v ...

  3. 【转】Vsftpd-3.0.2服务器arm-linux移植—mini2440开发板

    Vsftpd-3.0.2服务器arm-linux移植—mini2440开发板 开发板:mini2440(2011.04.21)环境:ubuntu9.10 为方便的将文件上传到开发板,采用vsftpd, ...

  4. EJB3.0开发环境的搭建

    EJB Container的介绍SUN公司正式推出了EJB的规范之后,在众多的公司和开发者中引起了非常大的反响.标志着用Java开发企业级应用系统将变的非常easy.很多公司都已经推出了或正打算EJB ...

  5. 【分享】iTOP4412开发板-Bluetooth移植文档

    [分享]iTOP4412开发板-Bluetooth移植文档 最近须要把Bluetooth移植到iTOP-4412 开发平台.查阅了相关资料,经过一段时间的研究.调试,最终成功的将蓝牙功能移植到了开发板 ...

  6. (转)规划从 OpenGL ES 2.0 到 Direct3D 的移植

    如果你移植 iOS 或 Android 平台中的游戏,那么你可能需要在 OpenGL ES 2.0 方面进行大量投资.如果你准备将你的图形管道代码库移动到 Direct3D 11 和 Windows ...

  7. 【VS开发】如何移植对话框?

    [VS开发]如何移植对话框? 标签:[VS开发] 问题描述:当开发好一个可视化界面的时候,想将其移植到另外的工程中,这个时候希望能够导出对话框资源,好直接在另一个工程中进行编辑,而不用再次编辑对话框上 ...

  8. IMX6开发板Qtopia2.2.0开发环境搭建以及编译镜像

    搭建 Qtopia2.2.0 开发环境,需要先搭建 Android 的编译环境,然后在 Android 编译环境的基础上,再搭建 Qtopia2.2.0 编译环境.以下内容基于迅为-iMX6开发板.Q ...

  9. ASP.NET Core 1.0 开发记录

    官方资料: https://github.com/dotnet/core https://docs.microsoft.com/en-us/aspnet/core https://docs.micro ...

随机推荐

  1. fzu 2113 数位dp

    #include<stdio.h> #include<string.h> #define N 20 #define ll __int64 ll dp[N][N];//最多记忆4 ...

  2. es6常用语法和特性

    简介 首先,在学习之前推荐使用在线转码器 Traceur 来测试 Demo,避免 babel 下的繁琐配置,从而产生畏难情绪. let 命令 在 ES6 之前,JS 只能使用 var 声明变量,或者省 ...

  3. java中文乱码问题的处理方式

    URL访问java时. 注意: URL: 编码二次 URLEncoder.encode(URLEncoder.encode(searchKey, "utf-8"),"ut ...

  4. PHP 关键词

    PHP 关键词 TCP 传输层通信协议 面向连接的.可靠的.基于字节流的 建立链接需要三次握手 Socket(套接字) 一个工具,一个接口 封装了TCP/IP协议 建立长链接的基础 HTTP 一个应用 ...

  5. 基于jQuery的图片加载loading效果插件

    基于jQuery的图片加载loading效果插件 图片loading的效果是网页中比较常见的,尤其是对大图片,loading效果让用户能够明白图片加载的过程. 实现思路也是比较简单的: $.fn.Lo ...

  6. poj_3006_Dirichlet's Theorem on Arithmetic Progressions_201407041030

    Dirichlet's Theorem on Arithmetic Progressions Time Limit: 1000MS   Memory Limit: 65536K Total Submi ...

  7. Uva 106 - Fermat vs. Pythagoras 解题报告

    数论题,考查了本原勾股数(PPT) 对一个三元组(a,b,c)两两互质 且满足 a2 + b2 = c2 首先有结论 a 和 b 奇偶性不同 c总是奇数(可用反证法证明,不赘述) 设 a为奇数 b为偶 ...

  8. Eclipse完成Maven + Spring Boot + Mybatis + jsp

    Spring Boot 完成WEB项目开发 开发工具:eclipse 框架:Maven:Spring Boot:Mybatis 界面:jsp:javascript:css 前言: 在SpringBoo ...

  9. 详解MySQL分区表

    当数据库数据量涨到一定数量时,性能就成为我们不能不关注的问题,如何优化呢? 常用的方式不外乎那么几种: 1.分表,即把一个很大的表达数据分到几个表中,这样每个表数据都不多. 优点:提高并发量,减小锁的 ...

  10. 关于Java函数不支持参数默认值的讨论,最后一条亮了 2333