完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,我有一些严肃的数学代码,在200 MHz的PIC32 MZ上运行大约6秒。问题是我一直在网上查看MZ能够从RAM中运行代码。我知道在MX中有2个场景要迎合,在Flash中从非RAM(如主())调用的任何函数,然后调用从RAM到RAM的任何函数。基本问题,有人帮助我跟踪如何用一些例子来做到这一点吗?此外,我希望你可能要修改一个Limkor脚本。我的应用程序链接器脚本被修改了,因为我有一个引导加载程序,所以我会附上以防万一。
以上来自于百度翻译 以下为原文 Hi, I've got some serious maths code that takes about 6 seconds on a pic32mz running at 200 MHz. Question is I've been looking online and can see that MZ is capable of running code from RAM. I understand in MX you have 2 scenarios to cater with, Any functions called from non RAM like main() in flash, and then any functions called from RAM to RAM. Basic question, anyone help me on track with how to do this with some examples? Also I expect you may have to modify a limker script. My App Linker script is modified anyway as I've got a bootloader, So I'll attach just in case. Attachment(s) app linker script.txt (52.59 KB) - downloaded 56 times |
|
相关推荐
19个回答
|
|
这两个有什么关系?你认为它会在RAM中运行得更快吗?
以上来自于百度翻译 以下为原文 How are these two related? Are you assuming it will run faster in RAM? |
|
|
|
另外,我不使用和声,我把我的应用程序和Bootloader移植成一个独立的应用程序,所以这里的和谐是不必要的。
以上来自于百度翻译 以下为原文 Also, I'm not using harmony, I've ported my app and bootloader as a standalone application so harmony is irrelavent here. |
|
|
|
对于QHB,是的,我知道RAM没有等待状态吗?请教
以上来自于百度翻译 以下为原文 to ^qhb , yes I understand RAM has no wait states?Please advice |
|
|
|
你可能是对的,但这是你原来的问题中一个未经陈述的假设。
以上来自于百度翻译 以下为原文 You may be right, but that was an unstated assumption in your original question. |
|
|
|
|
|
|
|
|
|
|
|
如果你需要RAM函数来提高速度,你应该在RunFunc上阅读编译器手册部分133.1。当在200 MHz下运行MZ时,CPU通常只需要两个Flash等待状态。RAMFUNC将提高速度,但在你的情况下,我不相信节省将是重要的。你在那6秒钟里做什么数学?我不太清楚为什么你要我们看你的链接脚本…
以上来自于百度翻译 以下为原文 If you need RAM functions to improve the speed, you should read the compiler manual Section 13.3.1 on ramfunc. When running a MZ at 200MHz, the CPU typically only needs two Flash wait states. A ramfunc will improve the speed but in your case, I am not convinced the saving will be significant. What kind of math are you doing in that 6 seconds? I am not quite sure why you want us to look your linker script... |
|
|
|
只是基础软件UIT88T数学,不需要硬件加速。这是我设计的一个天气预报算法,IP不能评论,但是如果Flash有2个等待状态,RAM有1个或没有,那么肯定有时间可以保存了吗?我尝试了一个编译器错误,也许我丢失了一些东西,或者我有一个过时的编译器等等。
以上来自于百度翻译 以下为原文 just basic software uint8_t maths, nothing needing hardware acceleration. Its an algorithm for weather forecasting I have devised and IP so cant comment, However If flash has 2 wait states and RAM has say 1 or none, then surely there is time to be saved? I tried __ramfunc__, compiler errored, Perhaps i'm missing something or i've got an outdated compiler etc etc |
|
|
|
|
|
|
|
嗨,我不确定你可能需要看看我的链接器脚本,它只是在这个问题上看MX帖子,提到链接器脚本,但是我很难看到MZ实例的RAM功能,我张贴链接脚本以防万一
以上来自于百度翻译 以下为原文 Hi, I'm not sure you may need to look at my linker script,Its just that looking at MX posts around this issue, linker scripts are mentioned, however im struggling to see MZ examples of ram functions,I posted linker script just in case etc |
|
|
|
你好,谢谢,但是我在寻找最初引用的代码,谢谢。
以上来自于百度翻译 以下为原文 Hi thanks, but im looking for example code as originally quoted, Thanks |
|
|
|
是的,但这通常不会转化为“节省2倍”的时间。此外,除了指令预取之外,MZ已经具有指令缓存。所以一定要确保正确设置。
以上来自于百度翻译 以下为原文 Yes, but that usually doesn't translate to "2 times faster" kind of time saving. Also, MZ already has instruction cache in addition to instruction prefetch. So do make sure you set them up properly. |
|
|
|
是的,它们是正确设置的:SysKys= 0x0;//写入无效键到强制锁SysKys0xAA96955;//将KEY1写入SysKySysKeK0x5666 99 AA;//将KEY2写入SysKyPrimePosits。Primon=3;PrimkButs.PfMWS=2;但我不谈论安装缓存和预取,我只想运行一个在PIC32 MZ上从RAM中起作用?有人有什么有用的意见吗?
以上来自于百度翻译 以下为原文 Yep they are set up correctly-: SYSKEY = 0x0; // write invalid key to force lock SYSKEY = 0xAA996655; // Write Key1 to SYSKEY SYSKEY = 0x556699AA; // Write Key2 to SYSKEY PRECONbits.PREFEN = 3; PRECONbits.PFMWS = 2; But im not talking about instuction cache and prefetch, I simply want to run a function from RAM on a pic32MZ?? Has anyone got any usefull comments? |
|
|
|
缓存和预取不应该进来吗????我说的是公羊
以上来自于百度翻译 以下为原文 cache and prefetch shouldnt come into it???? Im talking about RAM |
|
|
|
当你将αRM函数或γLangGrangeSuffi应用到函数时,你得到了什么错误?
以上来自于百度翻译 以下为原文 What error were you getting when you apply __ramfunc__ or __longramfunc__ to a function? |
|
|
|
请不要在论坛上“垃圾邮件”。在你发表之前思考,或者编辑以前的文章。小贴士的流只是让人失望。至于你的问题。1。虽然CPU总线是32位(1英寸)宽,但是到闪存的路径是128位(4个STN)。这意味着等待状态只需要1个4指令。即使这样,预取模块也会在需要之前预测并预取(因此它的名字)下一个128比特,消除4中的1个(除非有分支)。2。CPU具有16K 0等待状态指令高速缓存,这将在第一次运行之后消除环路等的等待状态。3。如果CPU有单独的RAM和闪存总线,那么可以同时访问指令和数据。但是,如果你从RAM中运行代码,你将与数据获取争用,所以当你可以加快指令提取速度时,*会减慢数据获取速度,这可能会以净减速的速度结束。4。如果你只是做Unt8t数学,你可以看看DSP SIMD指令,它在四字节向量上做各种数学函数。例如AUDUQB。这样做可能会加快速度。
以上来自于百度翻译 以下为原文 Please don't 'spam' the forum. Think before you post, or edit previous posts. Streams of small posts just p**s people off. As to your problem. 1. Whilst the CPU bus is 32bits (1 instn) wide, the path to flash is 128bit (4 instn). This means that the wait states are only required for 1 in 4 instructions. Even then the pre-fetch module will predict and pre-fetch (hence it's name) the next 128bits before it's needed, eliminating many of those 1 in 4 (unless a branch is taken). 2. The cpu has a 16k 0 wait state instruction cache, which will eliminate wait states for loops etc. after the first run through. 3. If the cpu has separate RAM and Flash busses, so can access instructions and data simultaneously. However if you run code from RAM you will contend with data fetches, so whilst you may speed up instruction fetches, you *will* slow down data fetches, which may end up as a net slow down. 4. If you are just doing uint8_t math, you could look at the DSP SIMD instructions, which do various math functions on quad byte vectors. e.g. ADDU.QB. You would probably get a geater speedup doing this. |
|
|
|
在我的“C:程序文件(x86) Microchip xC32 v1.44 示例 xc32实例 RAMION执行中,DIR是RAM执行的一个示例。我已经尝试过(前一段时间和以前的编译器)这段代码。也许这是迈向MZ的一步。我注意到您有XC32 1.33,我在我的1.34 AN中查看过。D代码看起来是相同的。编辑:山姆& Gt;
以上来自于百度翻译 以下为原文 I notice in my "C:Program Files (x86)Microchipxc32v1.44examplesxc32_examplesram_execution" dir an example for ram execution. I have tried ( some time ago with a previous compiler ) this code. Maybe it is a step towards getting it up on the MZ. I notice you have xc32 1.33, I looked in my 1.34 and the code looks to be the same. edit: sam -> same |
|
|
|
这个例子运行在好奇心PIC32 MZ EF结果中,当它进入RAM函数时,保留指令(0x0a)异常。
以上来自于百度翻译 以下为原文 This example run as is on the Curiosity PIC32MZ EF results in a reserved instruction (0x0a) exception as it enters the ram function. |
|
|
|
是的,我只需要在我的旧项目中使用它们(但是我的经验是有限的)。我和西蒙一起在缓存/ ETC上帮助正常的Flash执行。
以上来自于百度翻译 以下为原文 Yep, I just needed to use them in an old project of mine (but my experience is limited in this). I agre with Simon on the cache/etc stuff that help normal Flash execution. |
|
|
|
只有小组成员才能发言,加入小组>>
5584 浏览 9 评论
2228 浏览 8 评论
2115 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3399 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2433 浏览 5 评论
1070浏览 1评论
897浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
915浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
947浏览 0评论
我是Microchip 的代理商,有PIC16F1829T-I/SS 威廉希尔官方网站 问题可以咨询我,微信:A-chip-Ti
644浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-7-17 23:48 , Processed in 1.898023 second(s), Total 113, Slave 97 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191