Ubuntu安装MDK5

1 环境部署

  • Ubuntu 18.04
  • Wine 3.0.4

1.1 查看CPU信息

lscpu
序号属性描述
1架构x86_64
2CPU 运行模式32-bit, 64-bit
3字节序Little Endian
4CPU4
5在线 CPU 列表0-3
6每个核的线程数1
7每个座的核数4
81
9NUMA 节点1
10厂商 IDGenuineIntel
11CPU 系列6
13型号158
14型号名称Intel® Core™ i5-7400 CPU @ 3.00GHz
15步进9
16CPU MHz2748.422
17CPU 最大 MHz3500.0000
18CPU 最小 MHz800.0000
19BogoMIPS6000.00
20虚拟化VT-x
21L1d 缓存32K
22L1i 缓存32K
23L2 缓存256K
24L3 缓存6144K
25NUMA 节点0 CPU0-3

1.2 Wine环境

# 添加i386架构
sudo dpkg --add-architecture i386
# 安装64位wine
sudo apt install wine64
# 添加wineHQ签名密钥
wget -qO- https://dl.winehq.org/wine-builds/Release.key | sudo apt-key add -
# 添加存储库
sudo apt-add-repository 'deb http://dl.winehq.org/wine-builds/ubuntu/ artful main'

2 “安装”MDK

(1)将Win下安装的MDK文件,打包压缩,传送到Ubuntn;
(2)安装Pack,将MDK文件夹Pack中的.Download下载的pack文件离线安装;
(3)Ubuntu显示隐藏文件Ctrl+H;
(4)μVision⇒ Project⇒ Manage⇒ Pack Installer⇒ File⇒ Import⇒ Keil.STM32F1xx_DFP.1.0.5.pdsc;
(5)重启μVision即可新建工程;

3 问题

3.1 不能编译

--- Error: failed to execute '\home\xdq\install\MD\Kmdk514\core\ARM\ARMCC\Bin\ArmCC'

没有指定ARMCC
依次打开:
Project–>Manage–>Compoments,Books–>Folders/Extensions
在这里插入图片描述

图3.1 设置路径

3.2 编译错误

【Ubuntu源文件修改】

error You are building kernel with non-retpoline compiler, please update your compiler
make -C /lib/modules/4.15.0-50-generic/build  M=/home/xdq/install/Drivers/CH341SER_LINUX  
make[1]: 进入目录“/usr/src/linux-headers-4.15.0-50-generic”
arch/x86/Makefile:252: *** 分隔符缺失 (你大概想用 TAB,而不是八个空格)。 停止。
make[1]: 离开目录“/usr/src/linux-headers-4.15.0-50-generic”
Makefile:5: recipe for target 'default' failed
make: *** [default] Error 2

【进入】

/usr/src/$(uname -r)/arch/x86

【打补丁】

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index f5d7f41..75ef499 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -220,9 +220,6 @@ KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
 
 # Avoid indirect branches in kernel to deal with Spectre
 ifdef CONFIG_RETPOLINE
-ifeq ($(RETPOLINE_CFLAGS),)
-  $(error You are building kernel with non-retpoline compiler, please update your compiler.)
-endif
   KBUILD_CFLAGS += $(RETPOLINE_CFLAGS)
 endif
 
@@ -307,6 +304,13 @@ ifndef CC_HAVE_ASM_GOTO
 	@echo Compiler lacks asm-goto support.
 	@exit 1
 endif
+ifdef CONFIG_RETPOLINE
+ifeq ($(RETPOLINE_CFLAGS),)
+	@echo "You are building kernel with non-retpoline compiler." >&2
+	@echo "Please update your compiler." >&2
+	@false
+endif
+endif

【下载文件修改】

make -C /lib/modules/4.15.0-50-generic/build  M=/home/xdq/install/Drivers/CH341SER_LINUX  
make[1]: 进入目录“/usr/src/linux-headers-4.15.0-50-generic”
  CC [M]  /home/xdq/install/Drivers/CH341SER_LINUX/ch34x.o
/home/xdq/install/Drivers/CH341SER_LINUX/ch34x.c: 在函数‘ch34x_close’中:
/home/xdq/install/Drivers/CH341SER_LINUX/ch34x.c:591:2: 错误:未知的类型名‘wait_queue_t’
  wait_queue_t wait;
  ^~~~~~~~~~~~
/home/xdq/install/Drivers/CH341SER_LINUX/ch34x.c:591:15: 警告:未使用的变量‘wait’ [-Wunused-variable]
  wait_queue_t wait;
               ^~~~
/home/xdq/install/Drivers/CH341SER_LINUX/ch34x.c:590:7: 警告:未使用的变量‘timeout’ [-Wunused-variable]
  long timeout;
       ^~~~~~~
/home/xdq/install/Drivers/CH341SER_LINUX/ch34x.c:589:6: 警告:未使用的变量‘bps’ [-Wunused-variable]
  int bps;
      ^~~
/home/xdq/install/Drivers/CH341SER_LINUX/ch34x.c: 在函数‘wait_modem_info’中:
/home/xdq/install/Drivers/CH341SER_LINUX/ch34x.c:797:7: 错误:隐式声明函数‘signal_pending’ [-Werror=implicit-function-declaration]
   if( signal_pending(current) )
       ^~~~~~~~~~~~~~
cc1:有些警告被当作是错误
scripts/Makefile.build:337: recipe for target '/home/xdq/install/Drivers/CH341SER_LINUX/ch34x.o' failed
make[2]: *** [/home/xdq/install/Drivers/CH341SER_LINUX/ch34x.o] Error 1
Makefile:1552: recipe for target '_module_/home/xdq/install/Drivers/CH341SER_LINUX' failed
make[1]: *** [_module_/home/xdq/install/Drivers/CH341SER_LINUX] Error 2
make[1]: 离开目录“/usr/src/linux-headers-4.15.0-50-generic”
Makefile:5: recipe for target 'default' failed
make: *** [default] Error 2

注释或删除:wait_queue_t,long timeout,int bps
添加头文件: #include <linux/sched/signal.h>


[参考文献]
[1]https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=25896d073d8a0403b07e6dec56f58e6c33678207
[2]https://blog.csdn.net/nuttiny/article/details/79842900
[3]https://blog.csdn.net/jazzsoldier/article/details/70170466
[4]http://www.wch.cn/download/CH341SER_LINUX_ZIP.html

  • 6
    点赞
  • 37
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

天然玩家

坚持才能做到极致

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值