完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
您好,我需要用相同的源代码在我的Windows主机上构建16个不同的HEX文件,只需改变一个定义的值(从0到15)。有没有办法使这个过程自动化?问候,勒欧
以上来自于百度翻译 以下为原文 Hello, I need to build 16 different hex files on my Windows host with same source code, by only changing the value of a define (from 0 to 15). Is there a way to automate this process? Regards, Léo |
|
相关推荐
14个回答
|
|
如果你从命令行运行编译器/制作:当然。
以上来自于百度翻译 以下为原文 If you run the compiler/make from the command line: certainly. |
|
|
|
是的,这是我的想法,但是看起来XC16没有在Windows主机上使用这样的文件。
以上来自于百度翻译 以下为原文 Yes, that was my idea but it appears that XC16 is not documented for such usage on Windows host... |
|
|
|
|
|
|
|
用户手册的HikAPter 5可能不同意。对于一个定义的符号不同的构建,您可以在命令行中传递该特定符号的值。因此,一个批处理文件调用编译器16次,对于该特定符号和不同的输出文件名WI具有不同的值。然后再调用不同的输入和输出文件的链接器16行。编辑添加:甚至不需要从头开始创建整个命令行。复制IDE从其输出窗口生成的命令行并使用它们作为起始点。这是“QUI”。CK和脏的“解决方案”。一个更安全的方法是创建一个MaX文件并使用make实用工具来构建。再次,IDE创建的Mag文件是一个很好的起点。
以上来自于百度翻译 以下为原文 Hi Chapter 5 of the user manual might disagree. For different builds wich differ in one defined symbol, you can pass the value for that specific symbol in the command line. So a batch file that calls the compiler 16 times with different values for that specific symbol and different output filenames will do the trick. And then more 16 lines invoking the linker, again with different input and output filenames. EDIT ADD: You don't even need to create the whole command lines from scratch. Copy the command lines generated by the IDE from its output window and use them as a starting point This is the "quick and dirty" solution. A better and safer one would be to create a makefile and use the make utility to do the builds. Again, the makefile created by the IDE is a good starting point. |
|
|
|
使用HealthPoST生成将值添加到编译文件中。HeMax可以将值添加到特定的位置并生成新的HEX文件。
以上来自于百度翻译 以下为原文 Use Hexmate post build to add the value to the compiled file. Hexmate can add values to specific locations and generate a new hex file with the changes. |
|
|
|
HixMead对于序列号、MAC地址和其他类型的常量非常有用,但是“定义的符号”可能存在于HeMax范围之外的其他更复杂的情况下,如条件编译或编译时计算。因为OP没有给出任何细节,除了SP。具体的16个版本数,我不觉得它的序列号情况或类似。
以上来自于百度翻译 以下为原文 Hi Hexmate is quite usefull for serial numbers, mac addresses and other kinds of constants, but a "defined symbol" may be present in other more complex situations out of the scope of hexmate, like conditional compilation or compile time calculations.. As the OP didn't gave any details, besides the specific number of 16 builds, I don't feel its a serial number situation or alike. |
|
|
|
不确定你的观点。我在代码选择和未使用地址中引用了什么,并在代码中引用它,类似于HeMax中的-地址函数将该值添加到HEX文件中,类似于HexMeal-Outfile .HEX系列=00000 1 @ 1234文件。用一个实词来读取一个固定的位置,而不是C代码,但这是想法。显然,当编译器编译程序时,您需要选择一个不使用的位置。然后,用HexOut-OutFiel1.HEX系列=00000×1 @ 1234文件来创建批处理文件。HexOutMe- OutFiel2.2.HEX系列= 00000×2 @ 1234 InFiel.HeXETC,并将其称为后生成过程。
以上来自于百度翻译 以下为原文 Not sure of your point here. What I was think was 1) In the code pick and unused address and reference it in the code, something like void GetValue (void) { const UINT8 *TestLocation = (const UINT8 *)0x1234;; UINT8 Value; Value = *TestLocation; return(Value); } Then use the -ADDRESS function in hexmate to add that value to the hex file, something like hexmate -outfile.hex -SERIAL=000001@1234 infile.hex Not sure of the syntax of hexmate, and there is probably a pragma to read a fixed location rather that the C code, but this is the idea. Obviously you need to pick a location that will not be used when the compiler compiles the program. Then you make a batch file with hexmate -outfile1.hex -SERIAL=000001@1234 infile.hex hexmate -outfile2.hex -SERIAL=000002@1234 infile.hex etc, and call this as a post-build process. |
|
|
|
这里暗示着你的观点。我当时想的是,六合一怎么能帮助这样的事情呢?也就是说,“固定符号”可以比某个固定内存位置中的简单常量值大得多。
以上来自于百度翻译 以下为原文 Hi Not sure of your point here. What I was think was How do can hexmate assist in something like this? void LED_Flash(uint8_t NroLED, uint8_t NroFlashes, uint9_t Flashrate) { ................... ................... #ifdef BOARD_TYPE_A // === Code for accesing LED number 3 on A type boards ................... ................... #elif BOARD_TYPE_B // === Code for accesing LED number 3 on b type boards ................... ................... #else // Trigger a compiling error for unknown board type ................... ................... #endif ................... ................... } That is the point, a "defyned symbol" can be much more than a simple constant value in some fixed memory position. |
|
|
|
|
|
|
|
@ JorgeFAs表示希望有16个板编号为0。15,它最有可能是一个他想要“混合”的板ID。条件(数据依赖)编译可能是一个问题,但不一定:将数字插入到(有限数量)的操作码是可能的(虽然令人厌倦)。不同长度的x锉。
以上来自于百度翻译 以下为原文 @ JorgeF As he expressed the wish to have 16 boards numbered 0 .. 15, it is most likely a board ID he wants to "mix in". Conditional (data-dependent) compilation could be a problem, but not necessarily: inserting the number into a (limited number) of opcodes would be possible (although tiresome). HEXMATE ends where the different data results in sections or whole hexfiles of different length. |
|
|
|
HiYeah,我知道了。但是,OP没有明确地提到0…15的定义,因为是序列号或ID号。我提出了其他的可能性。
以上来自于百度翻译 以下为原文 Hi Yeah, I got that. But has the OP didn't explicitly mention the define from 0..15 as beeing a serial number or an ID number. I was bringing up other possibilities to atention. |
|
|
|
我假设这个数字是一个模型号码或节点地址,而不是一个序列号,它将在一个已知的闪存地址,甚至在闪存中。在这种情况下,脚本+Mag文件将是一条出路。您还可以通过创建16种不同的配置在IDE中完成它。
以上来自于百度翻译 以下为原文 I'm assuming the number is something like a model number or node address, not a serial number that would be at a known flash address or even in flash at all. In that case, a script + makefile would be the way to go. You could also do it in the IDE by creating 16 different configurations. |
|
|
|
我同意JTPLE:最有可能的数字是构成一个节点地址或类似的。只是一个猜测,但一个受过教育的。我曾经有过类似的问题(多达31个单位,相同的软件(但不同的S/NS)在一个系统内),但我的解决方案是不同的:按要求,所有单位在Taple表示它们的存在(传输它们的S/N)。然后动态分发入侵检测系统并存储在EEPROM中。
以上来自于百度翻译 以下为原文 I agree with jtemples: most likely the numbers are meant to constitute a node address or alike. Only a guess, but an educated one. I once had a similar problem (up to 31 units with identical software (but different S/Ns) within a single system), but my solution was different: on request, all units attached signaled their existence (transmitting their S/N). Then the IDs were distributed dynamically and stored in EEPROM. |
|
|
|
要从命令行构建XC16项目是IDE特性,请在该线程中阅读Jose Diaz的文章:HTTPS://www. McCHIP.COM/FUMMS/M660428ASPX
以上来自于百度翻译 以下为原文 To build a XC16 project from the command line is of an IDE feature, please read Jose Diaz's posts in this thread: https://www.microchip.com/forums/m660428.aspx |
|
|
|
只有小组成员才能发言,加入小组>>
5166 浏览 9 评论
2000 浏览 8 评论
1928 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3174 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2226 浏览 5 评论
733浏览 1评论
615浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
505浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
631浏览 0评论
528浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-24 03:59 , Processed in 1.297369 second(s), Total 105, Slave 88 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号