配置静态地址Ipv4
查看平台
uname -a
cat /etc/os-release
查看网络是哪个管理的
systemctl list-units --type=service | grep
查看网络具体由什么文件配置的
networkctl status end0
* 2: end0
Link File: /usr/lib/systemd/network/99-default.link
Network File: /usr/lib/systemd/network/80-wired.network
State: degraded (configuring)
Online state: online
Type: ether
Path: platform-5800a000.ethernet
Alternative Names: ethernet0
ethernet0.ethernet
Hardware Address: 10:e7:7a:e1:85:cf (STMicrolectronics International NV)
MTU: 1500 (min: 46, max: 9000)
QDisc: mq
IPv6 Address Generation Mode: eui64
Number of Queues (Tx/Rx): 8/8
Auto negotiation: yes
Speed: 100Mbps
Duplex: full
Port: tp
Address: fe80::12e7:7aff:fee1:85cf
Activation Policy: up
Required For Online: yes
DHCP6 Client DUID: DUID-EN/Vendor:0000ab112197d8406c94d1e2
Connected To: n/a on port 00:e0:4c:36:00:15
Jan 08 18:23:03 stm32mp1-e1-85-cf (udev-worker)[432]: end0: Failed to get driver for 'end0': Device or resource busy
Jan 11 12:16:12 stm32mp1-e1-85-cf systemd-networkd[648]: end0: Configuring with /usr/lib/systemd/network/80-wired.network.
Jan 11 12:16:12 stm32mp1-e1-85-cf systemd-networkd[648]: end0: Link UP
Jan 11 12:16:14 stm32mp1-e1-85-cf systemd-networkd[648]: end0: Gained carrier
Jan 11 12:16:16 stm32mp1-e1-85-cf systemd-networkd[648]: end0: Gained IPv6LL
编辑配置文件并重启
vi /usr/lib/systemd/network/80-wired.network
[Match]
Name=end0
[Network]
Address=172.30.0.10/24
Gateway=172.30.0.1
DNS=8.8.8.8
sudo systemctl restart systemd-networkd
编写代码并编译
#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}
编译
$CC main.c
检查文件属性
file a.out
a.out: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, BuildID[sha1]=*******f, for GNU/Linux 5.15.0, with debug_info, not stripped
ssh连接并传输文件

总结
我使用ubuntu22.04 环境配置sdk,并编译程序,利用ssh方式传输文件到开发板上,其中将开发板的地址改为静态地址方便下次连接使用,网口使用的是usb 网卡 在windows环境下直接配置固定地址即可 |