简体   繁体   English

无法为 PIC24FJ128GC006 的 linker 脚本定义 __BOOTLOADER

[英]Can't define __BOOTLOADER for linker script of PIC24FJ128GC006

I am making a USB Bootloader for PIC24FJ128GC006 and I am going to map part of the flash memory for the Bootloader and the Application code. I am making a USB Bootloader for PIC24FJ128GC006 and I am going to map part of the flash memory for the Bootloader and the Application code. I added the linker script from Microchip MLA v2015_08 usb device bootloader to my PIC24FJ code file.我将 Microchip MLA v2015_08 usb 设备引导加载程序中的 linker 脚本添加到我的 PIC24FJ 代码文件中。
In the linker file, the __BOOTLOADER must be defined in order to access the 0x400 address region.在 linker 文件中,必须定义__BOOTLOADER才能访问0x400地址区域。

    #ifdef __BOOTLOADER   
       program (xr)   : ORIGIN = 0x400,         LENGTH = 0x35BE
    #else
       program (xr)   : ORIGIN = 0x4002,         LENGTH = 0x117F4
    #endif

In the main.c of my bootloader code, I have already #define __BOOTLOADER , but when I program the bootloader code to the PIC using ICD3 and check the program memory by using the PIC Memory Views of MPLAB Window Toolbar, the data is written to the 0x4002 address and not in the 0x400 . In the main.c of my bootloader code, I have already #define __BOOTLOADER , but when I program the bootloader code to the PIC using ICD3 and check the program memory by using the PIC Memory Views of MPLAB Window Toolbar, the data is written to 0x4002地址而不是0x400
What can be the problem?可能是什么问题?

Okay.好的。 I have solved my problem above.我已经解决了我上面的问题。 You should write #define __BOOTLOADER in the linker file, not in main.c.您应该在 linker 文件中写入#define __BOOTLOADER,而不是在 main.c 中。 Another problem has risen though.然而,另一个问题又出现了。 In my code file dashboard, it indicates there that I have used 97% of the program memory after defining the __BOOTLOADER.在我的代码文件仪表板中,它表明我在定义 __BOOTLOADER 后使用了 97% 的程序 memory。 So my question is that, can I remove some codes in the linker file to decrease the used program memory?所以我的问题是,我可以删除 linker 文件中的一些代码以减少使用的程序 memory 吗? If yes, how can I know what to remove in the vector tables?如果是,我怎么知道要在向量表中删除什么?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM