完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
您好,我使用的是UDP Bootloader示例,但是我需要更改程序的IP。在代码中,我找到了用const value const值初始化IP的代码。
以上来自于百度翻译 以下为原文 Hi, I'm using the UDP bootloader sample but I need to change the IP of the program. On the code I've found where the IP is initialized with const value const TCPIP_NETWORK_CONFIG __attribute__((unused)) TCPIP_HOSTS_CONFIGURATION[] = { /*** Network Configuration Index 0 ***/ { TCPIP_NETWORK_DEFAULT_INTERFACE_NAME, // interface TCPIP_NETWORK_DEFAULT_HOST_NAME, // hostName TCPIP_NETWORK_DEFAULT_MAC_ADDR, // macAddr TCPIP_NETWORK_DEFAULT_IP_ADDRESS, // ipAddr TCPIP_NETWORK_DEFAULT_IP_MASK, // ipMask TCPIP_NETWORK_DEFAULT_GATEWAY, // gateway TCPIP_NETWORK_DEFAULT_DNS, // priDNS TCPIP_NETWORK_DEFAULT_SECOND_DNS, // secondDNS TCPIP_NETWORK_DEFAULT_POWER_MODE, // powerMode TCPIP_NETWORK_DEFAULT_INTERFACE_FLAGS, // startFlags &TCPIP_NETWORK_DEFAULT_MAC_DRIVER, // pMacObject }, }; const value are define like this #define TCPIP_NETWORK_DEFAULT_INTERFACE_NAME "PIC32INT" #define TCPIP_IF_PIC32INT #define TCPIP_NETWORK_DEFAULT_HOST_NAME "MCHPBOARD_E" #define TCPIP_NETWORK_DEFAULT_MAC_ADDR 0 #define TCPIP_NETWORK_DEFAULT_IP_ADDRESS "192.168.26.199" #define TCPIP_NETWORK_DEFAULT_IP_MASK "255.255.255.0" #define TCPIP_NETWORK_DEFAULT_GATEWAY "192.168.26.199" #define TCPIP_NETWORK_DEFAULT_DNS "192.168.26.199" #define TCPIP_NETWORK_DEFAULT_SECOND_DNS "0.0.0.0" #define TCPIP_NETWORK_DEFAULT_POWER_MODE "full" I don't find the solution to replace the const value; Thanks you |
|
相关推荐
8个回答
|
|
|
您想在运行时更改地址吗?然后你必须重写一些代码…添加一些变量等。
以上来自于百度翻译 以下为原文 You want to change the Address at runtime? Then you must rewrite some of the code... add some variables etc. |
|
|
|
|
|
假设您正在使用MHC和谐调度器,您可以在其中设置IP地址配置,它将调整您的代码。这条线(看起来你已经改变了它)是什么设置IP地址。你可能需要给我们一点关于你要做的事情的信息。
以上来自于百度翻译 以下为原文 Assuming you are using the MHC Harmony confgurator, you can set the IP address configuration there and it will adjust your code. This line ( it looks like you've changed it anyway ) is what sets the IP address. you might need to give us a little more info on what you are trying to do. #define TCPIP_NETWORK_DEFAULT_IP_ADDRESS "192.168.26.199" |
|
|
|
|
|
嗨,我已经在Flash中存储了IP,我可以读它并写它。我想在读Flash和在“TCPIPSISTACKIGIN()”之前打开我的配置板的IP。我试着创建一个结构来替换具有const值的结构,但是我找不到办法去做它。My IpCon无花果被储存在这样的结构里。谢谢你。
以上来自于百度翻译 以下为原文 Hi, I've stored the IP in flash, I can read it and write it. I would like to change the IP of the board at startup just after read my config in flash and before the "TCPIP_STACK_Init()". I've tried to create a structure to replace the one with the const value but I don't find the way to do it. My IpConfig is stored in a structure like this. typedef struct __attribute__ ((packed)) { IPV4_ADDR IP_Address; IPV4_ADDR IP_Mask; IPV4_ADDR DEFAULT_GATEWAY; IPV4_ADDR PRIMARY_DNS; IPV4_ADDR SECONDARY_DNS; //TCPIP_MAC_ADDR MAC_Address; uint16_t SERVER_PORT_MVT; uint16_t SERVER_PORT_HOST; uint16_t SERVER_PORT_DBG; uint16_t SERVER_PORT_SPV; }IP_CONFIG; Thanks you |
|
|
|
|
|
好的,我找到了解决办法,它很完美,希望对别人有所帮助。
以上来自于百度翻译 以下为原文 Ok I've found the solution IPV4_ADDR IP = EEPROM_Data.IpConfig.IP_Address; TCPIP_STACK_NetAddressSet(netH, (IPV4_ADDR *)&IP, (IPV4_ADDR *)&Mask, true); And it works perfectly Hope it will help someone |
|
|
|
|
|
所以我会这样开始:
以上来自于百度翻译 以下为原文 So I would start like this: #define TCPIP_NETWORK_DEFAULT_IP_ADDRESS EEPROM_Data.IpConfig.IP_Address But I can see you've already done it better :) so ok! |
|
|
|
|
|
我不能回答我自己,所以对你来说,DarioG又一次。
以上来自于百度翻译 以下为原文 I can't make answer to myself so it is for you DarioG once again |
|
|
|
|
|
好吧,下一个最好的(我以前做过了,也许你也做过了)
以上来自于百度翻译 以下为原文 Ok the next best one (I did it in the past and possibly you did it too) is strcpy (EEPROM_Data.IpConfig.IP_Address,TCPIP_NETWORK_DEFAULT_IP_ADDRESS); at boot when the EEprom is blank, and then use the EEprom data as you show. |
|
|
|
|
|
对不起,我再次尝试初始化配置后,但它不工作,我尝试过这一点,当我试图这样读回来,但我总是得到0.0.000 0.000 0.000。我真的需要初始化TecCPIPHooStx配置。真的需要帮助达里奥:
以上来自于百度翻译 以下为原文 Sorry back again I've tried to set the config after the initialization but it doesn't works I've tried this EEPROM_Data.IpConfig.IP_Address.Val = 0x301AA864;//192.168.026.100 EEPROM_Data.IpConfig.IP_Mask.Val = 0x10FFFFFF;//255.255.255.000 EEPROM_Data.IpConfig.DEFAULT_GATEWAY.Val = 0xFB1AA8C0;//192.168.026.254 EEPROM_Data.IpConfig.PRIMARY_DNS.Val = 0xFB1AA8C0;//192.168.026.254 EEPROM_Data.IpConfig.SECONDARY_DNS.Val = 0; TCPIP_NET_HANDLE netH; IPV4_ADDR IP = EEPROM_Data.IpConfig.IP_Address; IPV4_ADDR Mask = EEPROM_Data.IpConfig.IP_Mask; TCPIP_STACK_NetAddressSet(netH, (IPV4_ADDR *)&IP, (IPV4_ADDR *)&Mask, true); IP = EEPROM_Data.IpConfig.DEFAULT_GATEWAY; TCPIP_STACK_NetAddressGatewaySet(netH,(IPV4_ADDR *)&IP); IP = EEPROM_Data.IpConfig.PRIMARY_DNS; TCPIP_STACK_NetAddressDnsPrimarySet(netH,(IPV4_ADDR *)&IP); IP = EEPROM_Data.IpConfig.SECONDARY_DNS; TCPIP_STACK_NetAddressDnsSecondSet(netH,(IPV4_ADDR *)&IP); and when I tried to read them back like this IPV4_ADDR ipAddr; TCPIP_NET_HANDLE netH; const char *netName, *netBiosName; netH = TCPIP_STACK_IndexToNet(0); ipAddr.Val = TCPIP_STACK_NetAddress(netH); sprintf(buffChar1,"rnIP : %03d.%03d.%03d.%03d",ipAddr.v[0],ipAddr.v[1],ipAddr.v[2],ipAddr.v[3]);SendDebugBuffer(buffChar1,22); // ipAddr.Val = TCPIP_STACK_NetMask(netH); // ipAddr.Val = TCPIP_STACK_NetAddressGateway(netH); // ipAddr.Val = TCPIP_STACK_NetAddressDnsPrimary(netH); // ipAddr.Val = TCPIP_STACK_NetAddressDnsSecond(netH); But I always get 000.000.000.000 . I really need to initialize the TCPIP_HOSTS_CONFIGURATION . Really need help DarioG :) |
|
|
|
|
只有小组成员才能发言,加入小组>>
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
473 浏览 0 评论
5793 浏览 9 评论
2334 浏览 8 评论
2224 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3530 浏览 3 评论
1121浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
1095浏览 1评论
我是Microchip 的代理商,有PIC16F1829T-I/SS 技术问题可以咨询我,微信:A-chip-Ti
872浏览 1评论
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
473浏览 0评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-1 19:20 , Processed in 0.964148 second(s), Total 88, Slave 71 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
979