Microchip
直播中

张宁

7年用户 189经验值
私信 关注
[问答]

在启动和应用之间共享功能

您好,我正在询问共享功能,也许更具体的对象,比如系统文件,USB服务,和SPI通信在引导到应用程序之间。我有一个USB主机启动和USB主机MSD应用程序,并通过和谐V2Y05和IDE V4.05运行。应用程序和引导程序都对文件系统进行编程,在程序闪存的末尾找到对象并在引导和应用程序之间共享它是很好的。该应用程序正在增长到PIC32 MX695F512H的存储器的程度,并且合并冗余将是很好的。我在编译器链接器手册中一直在阅读这篇文章,这主要是链接器的问题,但是引用来自应用程序的函数或对象并不是很明显。我想指出在Bootloader中放置的对象中的函数的静态位置。你成功地编程了这样的怪兽,还有一些描述你的方法的阅读材料,你能给我指出那个材料吗?谢谢你考虑我的问题!西洛林格

以上来自于百度翻译


      以下为原文

    Hello,

I am inquiring about sharing functions and maybe more specifically objects like system files, USB services, and or SPI communication across the boot to the app. I have a USB host boot and u*** host MSD app up and running through hARMony v 2_05 and IDE v4.05. The app and boot both program the file system, and it would be nice to locate the object at the end of the program flash and share it between the boot and the app. The application is growing to the extent of the memory of the PIC32MX695F512H and it would be nice to consolidate the redundancy. I have been reading about this in the compiler linker manual and this is primarily a linker problem, but to reference the functions or objects from the applications is not so obvious. I want to point to the static position of the functions within the objects placed by the bootloader.

Have you successfully programmed such a beast and was there some reading material describing your method, could you point me to that material?
Thank you for considering my problem!

Cy Drollinger

回帖(1)

王淑英

2018-11-20 15:45:31
首先,您是否考虑从Bootloader中删除USB主机代码。我不知道你的设计细节,但在我们的设计中,我们有一个SPI闪存,用于下载新的代码。应用程序从USB、Internet、SD卡或任何地方获得新代码,并在SPI闪存中写入代码的新版本。Bootloader将代码从SPI Flash传输到程序存储器,这意味着很容易放弃一次失败的下载,因为只有SPI被写入,所以在SPI闪存中携带一个固件图像和在发生故障时重载和旧图像更容易携带。3)自举器是简单的,因为它只是传输数据,所以不太可能有BUGS4),引导加载程序非常小。如果你想用USB驱动程序保持引导加载程序。在Bootloader和主应用程序之间重用代码是可能的,1)保留一个程序存储器的一部分,它可以从APP和Bootloader访问,这意味着存储器的物理地址必须从两个固件中得知。2)在应用端,构造当您想在应用程序侧使用一个函数时,要在Bootloader端上写入所有函数的函数指针表,并将其写入Bootloader端。转到共享内存,并根据其在共享结构上的位置查找函数指针的地址,然后调用函数。

以上来自于百度翻译


      以下为原文

    First, did you consider removing the USB host code from the bootloader.  I do not know the details of your design, but in our designs we have a SPI flash reserved for downloading new code.  the application gets the new code form the USB, Internet, SD card or wherever, and writes the new version of the code in the SPI flash.  The bootloader transfers the code from SPI flash to program memory.
 
This means
1) It is easy to abandon a failed download, since only the SPI was written 
2) Its easy to carry more that one firmware image in SPI flash and reload and older image when failures occur.
3) The bootloader is simple, since it just transfers data, so is less likely to have bugs
4) The bootloader is very small.
 
If you want to keep the bootloader with the USB driver. It is possible to re-use code between the bootloader and the main application,
 
1) Reserve a section of program memory that can be accesses from both app and bootloader, this means that the physical address of the memory must be known from both pieces of firmware.
 
2) On the application side, construct a table of function pointers for all the functions you wish to share, and write the structure into the shared memory
 
3) On the bootloader side, when you want to use a function on the application side. go to the shared memory and look up the address of function pointer by its position on the shared structure, then call the function. 
 
 
 
 
 
 
举报

更多回帖

发帖
×
20
完善资料,
赚取积分