keil工程After Build/Rebuild添加带参.exe实现全流程(2):带参调用.exe的几种方法

0 工具准备

keil5工程
带参.exe

1 前言

使用keil编译生成了二进制镜像文件后,有时为了防止镜像被恶意修改,可以通过添加校验和来对整个镜像进行保护,实现手段就是在keil工程After Build/Rebuild中调用一些外部程序来为镜像添加校验和。本文基于keil5工程,介绍After Build/Rebuild添加带参.exe实现全流程(2):带参调用.exe的几种方法

2 带参调用.exe的几种方法

2.1 直接带参调用.exe

2.1.1 带参调用单个.exe

将带参调用.exe放到和keil5工程文件一个目录下(也可以放到其它目录下,只要给出正确的路径即可):
在这里插入图片描述
打开keil5工程,依次点击“options for Target…(魔法棒)”、User,勾选“Run #1”,在对应的“User Command”输入框输入“.\with_param.exe p1 p2”,这表示在当前keil5工程文件目录下运行with_param.exe,且参数1为p1,参

Rebuild started: Project: empty_LP_MSPM0G3507_nortos_keil *** Using Compiler 'V6.21', folder: 'D:\左猪崽\ARM\ARMCLANG\Bin' Rebuild target 'empty_LP_MSPM0G3507_nortos_keil' Note: source file '.\Car.c' - object file renamed from '.\Objects\Car.o' to '.\Objects\car_1.o'. Note: source file '.\BEEP.c' - object file renamed from '.\Objects\BEEP.o' to '.\Objects\beep_1.o'. Note: source file '.\Track.c' - object file renamed from '.\Objects\Track.o' to '.\Objects\track_1.o'. Note: source file '.\KEY.c' - object file renamed from '.\Objects\KEY.o' to '.\Objects\key_1.o'. Before Build - User command #1: cmd.exe /C "E:\TI\OLED2\OLED\examples\nortos\LP_MSPM0G3507\driverlib\empty\keil\../../../../../../tools/keil/syscfg.bat 'E:\TI\OLED2\OLED\examples\nortos\LP_MSPM0G3507\driverlib\empty\keil\' empty.syscfg" Using Sysconfig Tool from "E:\TI\sysconfig_cli.bat.bat" "Update the file located at <sdk path>/tools/keil/syscfg.bat to use a different version" Running script... Validating... info: /ti/project_config/ProjectConfig deviceSpin: Note: User must select a device after migration. Generating Code (empty.syscfg)... Writing E:\TI\OLED2\OLED\examples\nortos\LP_MSPM0G3507\driverlib\empty\ti_msp_dl_config.c... Unchanged E:\TI\OLED2\OLED\examples\nortos\LP_MSPM0G3507\driverlib\empty\ti_msp_dl_config.h... Unchanged E:\TI\OLED2\OLED\examples\nortos\LP_MSPM0G3507\driverlib\empty\Event.dot... assembling startup_mspm0g350x_uvision.s... ../empty.c(34): error: 'BEEP.h' file not found 34 | #include "BEEP.h" | ^~~~~~~~ 1 error generated. compiling empty.c... compiling delay.c... compiling ti_msp_dl_config.c... compiling board.c... BEEP.c(1): warning: In file included from... ./BEEP.h(1): warning: extra tokens at end of #ifndef directive [-Wextra-tokens] 1 | #ifndef BEEP.h | ^ | // ./BEEP.h(2): warning: ISO C99 requires whitespace after the macro name [-Wc99-extensions] 2 | #define BEEP.h | ^ BEEP.c(19): error: expected identifier or '(' 19 | void BEEP(int delay, int en){ | ^ ./BEEP.h(2): note: expanded from macro 'BEEP' BEEP.c(40): error: use of undeclared identifier 'DL_GPIO_PORT_A' 40 | DL_GPIO_togglePins(BEEP_GPIO, BEEP_GPIO_PIN);// 缈昏浆鐢靛钩 | ^ ./BEEP.h(4): note: expanded from macro 'BEEP_GPIO' 4 | #define BEEP_GPIO DL_GPIO_PORT_A // 浣跨敤TI椹卞姩搴撶殑瀹? | ^ BEEP.c(41): error: use of undeclared identifier 'DL_GPIO_PORT_A' 41 | DL_GPIO_togglePins(BEEP_GPIO, BEEP_LED_PIN);// 缈昏浆鐢靛钩 | ^ ./BEEP.h(4): note: expanded from macro 'BEEP_GPIO' 4 | #define BEEP_GPIO DL_GPIO_PORT_A // 浣跨敤TI椹卞姩搴撶殑瀹? | ^ BEEP.c(49): error: use of undeclared identifier 'DL_GPIO_PORT_A' 49 | DL_GPIO_setPins(BEEP_GPIO, BEEP_GPIO_PIN); | ^ ./BEEP.h(4): note: expanded from macro 'BEEP_GPIO' 4 | #define BEEP_GPIO DL_GPIO_PORT_A // 浣跨敤TI椹卞姩搴撶殑瀹? | ^ BEEP.c(50): error: use of undeclared identifier 'DL_GPIO_PORT_A' 50 | DL_GPIO_clearPins(BEEP_GPIO, BEEP_LED_PIN);//杈撳嚭浣庣數骞? | ^ ./BEEP.h(4): note: expanded from macro 'BEEP_GPIO' 4 | #define BEEP_GPIO DL_GPIO_PORT_A // 浣跨敤TI椹卞姩搴撶殑瀹? | ^ 2 warnings and 5 errors generated. compiling BEEP.c... Car.c(1): warning: extra tokens at end of #include directive [-Wextra-tokens] 1 | #include "Car.h".h" | ^ | // Car.c(1): warning: missing terminating '"' character [-Winvalid-pp-token] 1 | #include "Car.h".h" | ^ 2 warnings generated. compiling Car.c... Track.c(27): error: use of undeclared identifier 'Track_GPIO' 27 | if( DL_GPIO_readPins(Track_GPIO, Track_PIN_1) > 0 ) | ^ Track.c(27): error: use of undeclared identifier 'Track_PIN_1' 27 | if( DL_GPIO_readPins(Track_GPIO, Track_PIN_1) > 0 ) | ^ Track.c(29): error: use of undeclared identifier 'H' 29 | track[i] = H; //淇濈暀涓洪珮鐢靛钩 | ^ Track.c(34): error: use of undeclared identifier 'L' 34 | track[i] = L;//淇濈暀涓轰綆鐢靛钩 | ^ Track.c(38): error: use of undeclared identifier 'Track_GPIO' 38 | if( DL_GPIO_readPins(Track_GPIO, Track_PIN_2) > 0 ) | ^ Track.c(38): error: use of undeclared identifier 'Track_PIN_2' 38 | if( DL_GPIO_readPins(Track_GPIO, Track_PIN_2) > 0 ) | ^ Track.c(40): error: use of undeclared identifier 'H' 40 | track[i] = H; //淇濈暀涓洪珮鐢靛钩 | ^ Track.c(45): error: use of undeclared identifier 'L' 45 | track[i] = L;//淇濈暀涓轰綆鐢靛钩 | ^ Track.c(50): error: use of undeclared identifier 'Track_GPIO' 50 | if( DL_GPIO_readPins(Track_GPIO, Track_PIN_3) > 0 ) | ^ Track.c(50): error: use of undeclared identifier 'Track_PIN_3' 50 | if( DL_GPIO_readPins(Track_GPIO, Track_PIN_3) > 0 ) | ^ Track.c(52): error: use of undeclared identifier 'H' 52 | track[i] = H; //淇濈暀涓洪珮鐢靛钩 | ^ Track.c(57): error: use of undeclared identifier 'L' 57 | track[i] = L;//淇濈暀涓轰綆鐢靛钩 | ^ Track.c(61): error: use of undeclared identifier 'Track_GPIO' 61 | if( DL_GPIO_readPins(Track_GPIO, Track_PIN_4) > 0 ) | ^ Track.c(61): error: use of undeclared identifier 'Track_PIN_4' 61 | if( DL_GPIO_readPins(Track_GPIO, Track_PIN_4) > 0 ) | ^ Track.c(63): error: use of undeclared identifier 'H' 63 | track[i] = H; //淇濈暀涓洪珮鐢靛钩 | ^ Track.c(68): error: use of undeclared identifier 'L' 68 | track[i] = L;//淇濈暀涓轰綆鐢靛钩 | ^ Track.c(73): error: use of undeclared identifier 'Track_GPIO' 73 | if( DL_GPIO_readPins(Track_GPIO, Track_PIN_5) > 0 ) | ^ Track.c(73): error: use of undeclared identifier 'Track_PIN_5' 73 | if( DL_GPIO_readPins(Track_GPIO, Track_PIN_5) > 0 ) | ^ Track.c(75): error: use of undeclared identifier 'H' 75 | track[i] = H; //淇濈暀涓洪珮鐢靛钩 | ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. compiling Track.c... compiling oled.c... KEY.c(26): error: use of undeclared identifier 'KEY_GPIO' 26 | if( DL_GPIO_readPins(KEY_GPIO, KEY1) > 0 ) | ^ KEY.c(26): error: use of undeclared identifier 'KEY1' 26 | if( DL_GPIO_readPins(KEY_GPIO, KEY1) > 0 ) | ^ KEY.c(33): error: use of undeclared identifier 'KEY_GPIO' 33 | if( DL_GPIO_readPins(KEY_GPIO, KEY1) > 0 ) | ^ KEY.c(33): error: use of undeclared identifier 'KEY1' 33 | if( DL_GPIO_readPins(KEY_GPIO, KEY1) > 0 ) | ^ KEY.c(41): error: use of undeclared identifier 'KEY_GPIO' 41 | if( DL_GPIO_readPins(KEY_GPIO, KEY2) > 0 ) | ^ KEY.c(41): error: use of undeclared identifier 'KEY2' 41 | if( DL_GPIO_readPins(KEY_GPIO, KEY2) > 0 ) | ^ KEY.c(48): error: use of undeclared identifier 'KEY_GPIO' 48 | if( DL_GPIO_readPins(KEY_GPIO, KEY2) > 0 ) | ^ KEY.c(48): error: use of undeclared identifier 'KEY2' 48 | if( DL_GPIO_readPins(KEY_GPIO, KEY2) > 0 ) | ^ KEY.c(58): error: use of undeclared identifier 'KEY_GPIO' 58 | if( DL_GPIO_readPins(KEY_GPIO, KEY3) > 0 ) | ^ KEY.c(58): error: use of undeclared identifier 'KEY3' 58 | if( DL_GPIO_readPins(KEY_GPIO, KEY3) > 0 ) | ^ KEY.c(65): error: use of undeclared identifier 'KEY_GPIO' 65 | if( DL_GPIO_readPins(KEY_GPIO, KEY3) > 0 ) | ^ KEY.c(65): error: use of undeclared identifier 'KEY3' 65 | if( DL_GPIO_readPins(KEY_GPIO, KEY3) > 0 ) | ^ KEY.c(75): error: use of undeclared identifier 'KEY_GPIO' 75 | if( DL_GPIO_readPins(KEY_GPIO, KEY4) > 0 ) | ^ KEY.c(75): error: use of undeclared identifier 'KEY4' 75 | if( DL_GPIO_readPins(KEY_GPIO, KEY4) > 0 ) | ^ KEY.c(82): error: use of undeclared identifier 'KEY_GPIO' 82 | if( DL_GPIO_readPins(KEY_GPIO, KEY4) > 0 ) | ^ KEY.c(82): error: use of undeclared identifier 'KEY4' 82 | if( DL_GPIO_readPins(KEY_GPIO, KEY4) > 0 ) | ^ KEY.c(92): error: use of undeclared identifier 'KEY_GPIO' 92 | if( DL_GPIO_readPins(KEY_GPIO, KEY5) > 0 ) | ^ KEY.c(92): error: use of undeclared identifier 'KEY5' 92 | if( DL_GPIO_readPins(KEY_GPIO, KEY5) > 0 ) | ^ KEY.c(99): error: use of undeclared identifier 'KEY_GPIO' 99 | if( DL_GPIO_readPins(KEY_GPIO, KEY5) > 0 ) | ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. compiling KEY.c... ".\Objects\empty_LP_MSPM0G3507_nortos_keil.axf" - 44 Error(s), 4 Warning(s). Target not created. Build Time Elapsed: 00:00:03
最新发布
07-22
Build started: Project: DUOJI *** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\Keil_v5\ARM\ARMCC\Bin' Build target 'DUOJI' compiling main.c... ../Core/Src/main.c(133): error: #65: expected a ";" { ../Core/Src/main.c(155): warning: #12-D: parsing restarts here after previous syntax error Error_Handler(); ../Core/Src/main.c(70): warning: #177-D: variable "dir" was declared but never referenced uint8_t dir=1; ../Core/Src/main.c(160): error: #77-D: this declaration has no storage class or type specifier RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK ../Core/Src/main.c(160): error: #65: expected a ";" RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK ../Core/Src/main.c(162): error: #77-D: this declaration has no storage class or type specifier RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; ../Core/Src/main.c(162): error: #65: expected a ";" RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; ../Core/Src/main.c(163): error: #77-D: this declaration has no storage class or type specifier RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; ../Core/Src/main.c(163): error: #65: expected a ";" RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; ../Core/Src/main.c(164): error: #77-D: this declaration has no storage class or type specifier RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2; ../Core/Src/main.c(164): error: #65: expected a ";" RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2; ../Core/Src/main.c(165): error: #77-D: this declaration has no storage class or type specifier RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; ../Core/Src/main.c(165): error: #65: expected a ";" RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; ../Core/Src/main.c(167): error: #169: expected a declaration if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) ../Core/Src/main.c(207): warning: At end of source: #12-D: parsing restart
03-26
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

NW嵌入式开发

感谢您的支持,让我们一起进步!

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

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

打赏作者

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

抵扣说明:

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

余额充值