完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我的任务是清除(设置为0)所有的RAM中的PIC32 MZ2048 EFH1。XC32编译器已经清除了多少RAM。全局和静态。只是堆和堆栈吗?2。使用Ion OnReStE.()看起来这是可能的。但是它不能使用RAM。需要避免其他领域吗?堆栈?或者这里真的需要ASM吗?
以上来自于百度翻译 以下为原文 I am Tasked with clearing ( set to 0) All the RAM in a PIC32MZ2048EFH 1. How Much of the RAM does the XC32 compiler already clear. Globals and Statics. Is it Just The Heap and the Stack? 2. Using _on_reset() looks like it would be a possibility. _on_bootstrap() too late * I assume a careful C function could work. but it could not use RAM. would it need to avoid other areas? The Stack? * Or is ASM really needed here? |
|
相关推荐
11个回答
|
|
没有接受者?我开始讲:拆卸是:我将查看和介绍MIPS ASM NEX.1这是否出现写不使用RAM?2、内存区域定义在哪里?(堆栈,持久,ect)3。ON-Read被调用吗?在堆栈中,它是不安全的吗?4。ISOVAL ONI重置(空)正确的原型?5、如何使编译器产生列表文件,并在何处隐藏它们?
以上来自于百度翻译 以下为原文 No Takers? I am starting with : void _on_reset(void) { register uint32_t X; register uint8_t *pointer; Nop(); // breakpoint Target for(X = 0; X < 1024; X++) { Nop(); // breakpoint Target *pointer = 0; pointer++; } } The DIsassembly is: !void _on_reset(void) !{ ! register uint32_t X; ! register uint8_t *pointer; ! ! Nop(); // breakpoint Target 0x9D15CB54: SRL ZERO, ZERO, 0 0x9D15CB58: ADDU S0, S0, S0 ! for(X = 0; X < 1024; X++) 0x9D15CB64: LW V0, -3(ZERO) 0x9D15CB68: NOP ! { ! Nop(); // breakpoint Target 0x9D15CB5C: SRL ZERO, ZERO, 0 0x9D15CB60: LW V0, -1(V0) ! *pointer = 0; ! pointer++; ! } ! !} 0x9D15CB6C: MOVN ZERO, ZERO, RA 0x9D15CB70: NOP I will be looking and Intro to MIPS Asm next. 1.Does this appear write without using RAM? 2.Where are memory areas defined? (stack, persistent ,ect) 3. is on_reset called? as in it is not safe to zero the stack? 4. is void _on_reset(void) the correct prototype? 5.How you you make the compiler produce list files, and where does it hid them? |
|
|
|
是的,但是对于这样的事情,我建议坚持使用汇编程序。链接器脚本。有些部分是由链接器动态创建的。很早,调用是在CRT0.S中执行的。因为MIPS将函数返回地址存储在寄存器中,此时在堆栈上不应该存储任何东西。唯一的例外是,如果你有一个自定义的NMI处理器,它存储在RAM中的东西,因为它将被称为“提前”。
以上来自于百度翻译 以下为原文 Yes, though for something like this I'd recommend sticking to assembly. The linker script. Some sections are dynamically created by the linker. Quite early, the call is performed in crt0.S. Since MIPS stores the function return address in a register, there should not be anything stored on the stack at this point. The only exception would be if you have a custom NMI handler that stores something in RAM, as it will be called earlier. Yes. |
|
|
|
默认情况下,编译器将所有静态分配的对象初始化为零,如果它们没有初始化器。它不能清除RAM。为什么需要清除所有的RAM?生成列表文件的最简单方法是将此命令行添加到POST Bug:${MPYCccdidi}xC32 ObjDIP-S $ {IMADIDER } $PurruteNe}。${IMAGEYTYPE }。ELF&GT;MyApjExpTyList.Listt基本上调用带有-S选项的XC32 ObjDIPP并传递到ELF文件中。${MyCccIdir }表示编译器的bin文件夹。
以上来自于百度翻译 以下为原文 Compiler, by default, initializes all static allocated objects to zero if they don't have an initializer. It does not clear RAM. Why do you need to clear all the RAM? The easiest way to produce a list file is to add this command line to the post build: ${MP_CC_DIR}xc32-objdump -S ${ImageDir}${PROJECTNAME}.${IMAGE_TYPE}.elf > my_project_list.lst It is basically calling xc32-objdump with -S option and pass in the elf file. ${MP_CC_DIR} represents the compiler's bin folder. |
|
|
|
我需要清除所有的RAM,因为我被告知我需要。我知道全局和静态被初始化,或者归零。列表转储工作,谢谢。我可以用它作为ASM启动,如果我需要去那里。快速启动MIPS ASM书籍/站点。因此,在yon OnReSeTo()阶段,我应该使用RAM的0xA000 000到0xAA1FFFF的UNACHEDATION,此时我可以编写整个RAM。(减去保存的区域)这比我更容易,这让我很担心。
以上来自于百度翻译 以下为原文 I Need to clear all the RAM because I was told I need to. I am aware Globals and statics are initialized, or zeroed. The List Dump worked, Thanks for that. I can use that as an ASM start if I need to go there. And quick start MIPS ASM books/sites. so at the _on_reset() stage should I be using the Uncached Address for the RAM 0xA0000000 to 0xA001FFFF And at this point I could write the whole RAM. (minus the Preserved Areas). This seems easier than I though, and that worries me. |
|
|
|
好的,这个“似乎是有效的”调试器显示它清除0xA000 00 380到0xA00 1FFFF,除了溢出区域。它不会崩溃。问题:1。IDE MARKS0xA000 000到0xA000 R380作为“RRRRRRR”,是不是意味着我不应该触摸它,或者写信给它是不安全的?有什么?2。列表ASM显示它不使用RAM吗?
以上来自于百度翻译 以下为原文 OK This "Appears to work" #define PERSISTANT_MEMORY_BASE 0x80012270 #define PERSISTANT_MEMORY_SIZE 8 void _on_reset(void) { #define RAM_BASE 0xA0000380 // KSEG1 Uncached Address #define RAM_END 0xA001FFFF // KSEG1 Uncached Address (512K bytes, 128Kwords) register uint32_t *pointer = (uint32_t *)RAM_BASE; // Make sure the variable in NOT in RAM do { if(pointer == (uint32_t *)KVA0_TO_KVA1(PERSISTANT_MEMORY_BASE)) // in the persistent memory Area? { pointer += PERSISTANT_MEMORY_SIZE; // skip the persistent memory Area } *pointer = 0x00000000; // Clear the RAM pointer++; // Next } while(pointer < (uint32_t *)RAM_END); } void _on_reset(void) { #define RAM_BASE 0xA0000380 // KSEG1 Uncached Address #define RAM_END 0xA001FFFF // KSEG1 Uncached Address (512K bytes, 128Kwords) register uint32_t *pointer = (uint32_t *)RAM_BASE; // Make sure the variable in NOT in RAM 9d157224: 3c02a000 lui v0,0xa000 9d157228: 24420380 addiu v0,v0,896 do { if(pointer == (uint32_t *)KVA0_TO_KVA1(PERSISTANT_MEMORY_BASE)) // in the persistent memory Area? 9d15722c: 3c06a001 lui a2,0xa001 9d157230: 24c42270 addiu a0,a2,8816 pointer += PERSISTANT_MEMORY_SIZE; // skip the persistent memory Area } *pointer = 0x00000000; // Clear the RAM pointer++; // Next } while(pointer < (uint32_t *)RAM_END); 9d157234: 34c5ffff ori a1,a2,0xffff 9d157238 <.LVL200>: register uint32_t *pointer = (uint32_t *)RAM_BASE; // Make sure the variable in NOT in RAM do { if(pointer == (uint32_t *)KVA0_TO_KVA1(PERSISTANT_MEMORY_BASE)) // in the persistent memory Area? 9d157238: 54440004 bnel v0,a0,9d15724c <.LVL203> 9d15723c: ac400000 sw zero,0(v0) 9d157240 <.LVL201>: { pointer += PERSISTANT_MEMORY_SIZE; // skip the persistent memory Area } *pointer = 0x00000000; // Clear the RAM 9d157240: acc02290 sw zero,8848(a2) 9d157244 <.LVL202>: pointer++; // Next 9d157244: 0b455c8e j 9d157238 <.LVL200> 9d157248: 24c22294 addiu v0,a2,8852 9d15724c <.LVL203>: 9d15724c: 24420004 addiu v0,v0,4 } while(pointer < (uint32_t *)RAM_END); 9d157250: 0045182b sltu v1,v0,a1 9d157254: 1460fff8 bnez v1,9d157238 <.LVL200> 9d157258: 00000000 nop } 9d15725c: 03e00008 jr ra 9d157260: 00000000 nop Debugger shows it clearing 0xA0000380 to 0xA001FFFF, except the Persisant Area. And it does not crash. Questions: 1. The IDE marks 0xA0000000 to 0xA0000380 as "RRRRRRRR" does that mean I should not touch it or it is not safe to write to? What is there? 2. Does the List ASM show it not using RAM |
|
|
|
因为你被告知你会因为被告知要跳过一座桥吗?来吧,为什么很重要。
以上来自于百度翻译 以下为原文 Becuase you were told to. Would you jump off a bridge because you were told to? Come on, the why is important. |
|
|
|
对。在初始化缓存之前调用ONYRead函数。这实际上是我没有想到的——您需要确保您的代码在KSEG1中运行,这可能是个问题,因为KSSE1BooToMeMm和KSK1BoObMyMy4B0部分不是那么大。当调试时,RAM的启动是由调试执行器保留的。MPLAB X帮助文件中有一个保留资源表,也在发行说明中。
以上来自于百度翻译 以下为原文 Yes. The on_reset function is called before the cache is initialized. That's actually something I hadn't thought of - you need to make sure your code runs in kseg1 which can be a bit of a problem, since the kseg1_boot_mem and kseg1_boot_mem_4B0 sections aren't that big. When debugging, the start of RAM is reserved by the debug executive. There's a table of reserved resources somewhere in the MPLAB X help files, and also in the release notes. |
|
|
|
我假设C运行时负责运行KSEG1。它确实有效。而且代码很小。如果调试器在那里,我将在380h启动。如果不是的话。这是一个有趣的练习。我想我应该尝试一下MIPS ASM。它可能使这更容易。
以上来自于百度翻译 以下为原文 I assume the C runtime takes care of running out of kseg1. It does work. And the code is pretty small. I will start at 380h if the debugger is there. And 0h if not. This was an interesting exercise. I guess I should try a little mips ASM. It may have made this easier. |
|
|
|
函数将被链接到任何地址调用。不幸的是,这是在调试器下运行几乎肯定会改变系统的行为的情况之一,但是不使用调试器进行观察是非常困难的。我还没有检查核心手册,但是传统上在MIPS系统中启用了高速缓存,但在加电或复位之后,它们的状态未被定义,这就是为什么KSEG0/KSEG1分割在一开始就存在的原因。
以上来自于百度翻译 以下为原文 The function will be called at whatever address it's linked at. Unfortunately this is one of those cases where running under a debugger almost certainly alters the behaviour of the system, but making observations without a debugger is very difficult. I haven't checked the core manual yet, but traditionally in MIPS systems the caches are enabled but their states undefined after powerup or reset, which is why the whole KSEG0/KSEG1 split exists in the first place. |
|
|
|
也许B类安全关键的东西有一个内存检查/清除HTTP://www. McClask.com….ASPX?AppNeNo.En535355
以上来自于百度翻译 以下为原文 perhaps the Class B safety critical stuff has a memory check/clear http://www.microchip.com/....aspx?appnote=en537355 |
|
|
|
* IFIFF f调试工具定义RAMOBASE 0xA000 00 380//KSG1未编码地址,否则定义RAMOBASE 0xA000 0//KSG1未编码地址,NyFi查看B类的内容,很晚才清除任何东西。你只能清除未使用的部分。
以上来自于百度翻译 以下为原文 #ifdef __DEBUG #define RAM_BASE 0xA0000380 // KSEG1 Uncached Address #else #define RAM_BASE 0xA0000000 // KSEG1 Uncached Address #endif I looked at the Class B stuff, It happens to late to clear anything. You could only clear unused sections. |
|
|
|
只有小组成员才能发言,加入小组>>
5192 浏览 9 评论
2012 浏览 8 评论
1936 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3183 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2238 浏览 5 评论
746浏览 1评论
633浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
517浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
644浏览 0评论
544浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-1 13:35 , Processed in 1.726101 second(s), Total 99, Slave 82 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号