• slider image 442
  • slider image 483
  • slider image 484
  • slider image 485
  • slider image 486
  • slider image 487
:::

論壇索引


Board index » All Posts (a16450)




CAN Bootloader Host
#1
初級會員
初級會員


各位先進好, 我使用的晶片是p32mk1024mcm100.
近期開發CAN Bootloader, 參考CAN Bootloader Protocol和參考MPLAB® Harmony 3 CAN Bootloader Application Examples.
build過, 但是問題來了.
請問官方或是有先進有尚未機可以做測試嗎? 或是可以參考的資料?
再麻煩各位先進可以指導

發表於: 12/6 16:55
頂部


pic32mk使用debug時overlaps section reserve_data_0_kseg0
#2
初級會員
初級會員


各位新進大家好, 我這邊有一個問題需要協助
我使用
1. 晶片:pic32mk1024mcm100
2. IDE版本: v6.05
3. complier版本: XC32 v4.10

我使用保留前段ram給classb以及blt pattern做使用
在一般使用不會報錯,但是使用debug就會跑出overlaps section:
section .shared VMA [0000000080000008,00000000800001ffoverlaps section reserve_data_0_kseg0 VMA [0000000080000000,000000008000036f]


我找不到"reserve_data_0_kseg0 "的實際定址的地方
以下是我修改的局部linker script:
MEMORY
{
...
  
SHARED               (w!x)  : ORIGIN 0x80000008LENGTH 0x200 0x8
  kseg0_data_mem       
(w!x)  : ORIGIN 0x80000400LENGTH 0x40000 0x400
...
}

/*************************************************************************
 * Configuration-word sections. Map the config-pragma input sections to
 * absolute-address output sections.
 *************************************************************************/
SECTIONS
{
  .
shared (NOLOAD) :
  {
    . = 
ALIGN(4);
    
_sshared = .;
    
__shared_start__ _sshared;
    *(.
shared)
    *(.
shared.*)
    
KEEP(*(.shared)) 
    . = 
ALIGN(4);
    
_eshared = .;
    
__shared_end__ _eshared;
  } >
SHARED
...
}


其他沒有變動的用"..."表示

以下是我覺得可能有overlap的section但我不確定是哪一個造成的:
SECTIONS
{
...
  .
dbg_data (NOLOAD) :
  {
    . += (
DEFINED (_DEBUGGER) ? 0x200 0x0);
    
/* Additional data memory required for DSPr2 registers */
    
. += (DEFINED (_DEBUGGER) ? 0x80 0x0);
    
/* Additional data memory required for FPU64 registers */
    
. += (DEFINED (_DEBUGGER) ? 0x100 0x0);
  } >
kseg0_data_mem
  
.jcr   :
  {
    
KEEP (*(.jcr))
    . = 
ALIGN(4) ;
  } >
kseg0_data_mem
  
.eh_frame    ONLY_IF_RW
  
{
    
KEEP (*(.eh_frame))
  } >
kseg0_data_mem
    
. = ALIGN(4) ;
  .
gcc_except_table    ONLY_IF_RW
  
{
    *(.
gcc_except_table .gcc_except_table.*)
  } >
kseg0_data_mem
    
. = ALIGN(4) ;
  
/* Persistent data - Use the new C 'persistent' attribute instead. */
  
.persist   :
  {
    
_persist_begin = .;
    *(.
persist .persist.*)
    . = 
ALIGN(4) ;
    
_persist_end = .;
  } >
kseg0_data_mem
  
/*
   *  Note that input sections named .data* are not mapped here.
   *  The best-fit allocator locates them, so that they may flow
   *  around absolute sections as needed.
   */
  
.data   :
  {
    *( .
gnu.linkonce.d.*)
    
SORT(CONSTRUCTORS)
    *(.
data1)
    . = 
ALIGN(4) ;
  } >
kseg0_data_mem
  
. = .;
  
_gp ALIGN(16) + 0x7ff0;
  .
got ALIGN(4) :
  {
    *(.
got.plt) *(.got)
    . = 
ALIGN(4) ;
  } >
kseg0_data_mem /* AT>kseg0_program_mem */
  /*
   * Note that 'small' data sections are still mapped in the linker
   * script. This ensures that they are grouped together for
   * gp-relative addressing. Absolute sections are allocated after
   * the 'small' data sections so small data cannot flow around them.
   */
  /*
   * We want the small data sections together, so single-instruction offsets
   * can access them all, and initialized data all before uninitialized, so
   * we can shorten the on-disk segment size.
   */
  
.sdata ALIGN(4) :
  {
    
_sdata_begin = . ;
    *(.
sdata .sdata.* .gnu.linkonce.s.*)
    . = 
ALIGN(4) ;
    
_sdata_end = . ;
  } >
kseg0_data_mem
  
.lit8           :
  {
    *(.
lit8)
  } >
kseg0_data_mem
  
.lit4           :
  {
    *(.
lit4)
  } >
kseg0_data_mem
  
. = ALIGN (4) ;
  
_data_end = . ;
  
_bss_begin = . ;
  .
sbss ALIGN(4) :
  {
    
_sbss_begin = . ;
    *(.
dynsbss)
    *(.
sbss .sbss.* .gnu.linkonce.sb.*)
    *(.
scommon)
    
_sbss_end = . ;
    . = 
ALIGN(4) ;
  } >
kseg0_data_mem
  
/*
   *  Align here to ensure that the .bss section occupies space up to
   *  _end.  Align after .bss to ensure correct alignment even if the
   *  .bss section disappears because there are no input sections.
   *
   *  Note that input sections named .bss* are no longer mapped here.
   *  The best-fit allocator locates them, so that they may flow
   *  around absolute sections as needed.
   *
   */
  
.bss     :
  {
    *(.
dynbss)
    *(
COMMON)
   
/* Align here to ensure that the .bss section occupies space up to
      _end.  Align after .bss to ensure correct alignment even if the
      .bss section disappears because there are no input sections. */
   
. = ALIGN(. != 1);
  } >
kseg0_data_mem
  
. = ALIGN(4) ;
  
_end = . ;
  
_bss_end = . ;
  
/*
   *  The heap and stack are best-fit allocated by the linker after other
   *  data and bss sections have been allocated.
   */
  /*
   * RAM functions go at the end of our stack and heap allocation.
   * Alignment of 2K required by the boundary register (BMXDKPBA).
   *
   * RAM functions are now allocated by the linker. The linker generates
   * _ramfunc_begin and _bmxdkpba_address symbols depending on the
   * location of RAM functions.
   */
  
_bmxdudba_address LENGTH(kseg0_data_mem) ;
  
_bmxdupba_address LENGTH(kseg0_data_mem) ;
    
/* The .pdr section belongs in the absolute section */
    
/DISCARD/ : { *(.pdr) }
  .
gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
  .
gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
  .
mdebug.abi32 0 : { KEEP(*(.mdebug.abi32)) }
  .
mdebug.abiN32 0 : { KEEP(*(.mdebug.abiN32)) }
  .
mdebug.abi64 0 : { KEEP(*(.mdebug.abi64)) }
  .
mdebug.abiO64 0 : { KEEP(*(.mdebug.abiO64)) }
  .
mdebug.eabi32 0 : { KEEP(*(.mdebug.eabi32)) }
  .
mdebug.eabi64 0 : { KEEP(*(.mdebug.eabi64)) }
  .
gcc_compiled_long32 : { KEEP(*(.gcc_compiled_long32)) }
  .
gcc_compiled_long64 : { KEEP(*(.gcc_compiled_long64)) }
  
/* Stabs debugging sections.  */
  
.stab          0 : { *(.stab) }
  .
stabstr       0 : { *(.stabstr) }
  .
stab.excl     0 : { *(.stab.excl) }
  .
stab.exclstr  0 : { *(.stab.exclstr) }
  .
stab.index    0 : { *(.stab.index) }
  .
stab.indexstr 0 : { *(.stab.indexstr) }
  .
comment       0 : { *(.comment) }
  
/* DWARF debug sections used by MPLAB X for source-level debugging. 
     Symbols in the DWARF debugging sections are relative to the beginning
     of the section so we begin them at 0.  */
  /* DWARF 1 */
  
.debug          0 : { *.elf(.debug) *(.debug) }
  .
line           0 : { *.elf(.line) *(.line) }
  
/* GNU DWARF 1 extensions */
  
.debug_srcinfo  0 : { *.elf(.debug_srcinfo) *(.debug_srcinfo) }
  .
debug_sfnames  0 : { *.elf(.debug_sfnames) *(.debug_sfnames) }
  
/* DWARF 1.1 and DWARF 2 */
  
.debug_aranges  0 : { *.elf(.debug_aranges) *(.debug_aranges) }
  .
debug_pubnames 0 : { *.elf(.debug_pubnames) *(.debug_pubnames) }
  
/* DWARF 2 */
  
.debug_info     0 : { *.elf(.debug_info .gnu.linkonce.wi.*) *(.debug_info .gnu.linkonce.wi.*) }
  .
debug_abbrev   0 : { *.elf(.debug_abbrev) *(.debug_abbrev) }
  .
debug_line     0 : { *.elf(.debug_line) *(.debug_line) }
  .
debug_frame    0 : { *.elf(.debug_frame) *(.debug_frame) }
  .
debug_str      0 : { *.elf(.debug_str) *(.debug_str) }
  .
debug_loc      0 : { *.elf(.debug_loc) *(.debug_loc) }
  .
debug_macinfo  0 : { *.elf(.debug_macinfo) *(.debug_macinfo) }
  
/* SGI/MIPS DWARF 2 extensions */
  
.debug_weaknames 0 : { *.elf(.debug_weaknames) *(.debug_weaknames) }
  .
debug_funcnames 0 : { *.elf(.debug_funcnames) *(.debug_funcnames) }
  .
debug_typenames 0 : { *.elf(.debug_typenames) *(.debug_typenames) }
  .
debug_varnames  0 : { *.elf(.debug_varnames) *(.debug_varnames) }
  .
debug_pubtypes 0 : { *.elf(.debug_pubtypes) *(.debug_pubtypes) }
  .
debug_ranges   0 : { *.elf(.debug_ranges) *(.debug_ranges) }
  /
DISCARD/ : { *(.rel.dyn) }
  .
gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
  /
DISCARD/ : { *(.note.GNU-stack) }
  /
DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.discard) }
}

發表於: 2023/8/4 9:28
頂部


Re: 16-bit bootloader mcc產生code問題
#3
初級會員
初級會員


解決了 有相同問題的人可以提出一起討論看看

發表於: 2023/5/8 14:59
頂部


16-bit bootloader mcc產生code問題
#4
初級會員
初級會員


晶片是dspic33ep256mc504
用mcc core v5.5.0
16-bit bootloader v1.22.1
我使用16-bit bootloader後再bootloader與application個別compile都沒有問題
但把application load到bootloader變成loaderable project後出現下列錯誤
據我所知 address 0x0 是reset vector的位置,但gen code出來的檔案不像32bit的mcc會弄出linker script
(1600"../AU1803.X/dist/default/production/AU1803.X.production.hex" argument data in "../AU1803.X/dist/default/production/AU1803.X.production.hex" conflicts with existing data at address 0x0
(1600"../AU1803.X/dist/default/production/AU1803.X.production.hex" argument data in "../AU1803.X/dist/default/production/AU1803.X.production.hex" conflicts with existing data at address 0x1
make
[2]: *** [dist/default/production/bootloader_dspic33e_mc.X.production.hexError 1
make
[1]: *** [.build-confError 2
make
: *** [.build-implError 2

BUILD FAILED 
(exit value 2total time2s)


請問各位先進是否有辦法解決這個問題? step by step

發表於: 2023/4/25 15:14
頂部


Re: 關於mcc的generate code
#5
初級會員
初級會員


參照:

Darren wrote:
Hi a16450

Q:請問有先進知道在改名configuration後設定如何修改才能在連到正確的路徑嗎?

A:開發專案建議只使用一個MCC的設定專案,如需修改其他暫存器,可從MCC Generate Source/Header Code 進行修改暫存器設定值。

假設,需要如您說的做法,請按照底下步驟:
1.備份原專案。
2.關閉MPLAB X IDE
3.打開專案資料夾,找到nbproject資料夾,在裡面會找到configurations.xml檔案,打開檔案往下搜尋找到"Lab0_First_Project.mc3"(Lab0_First_Project : 我的MCC專案名稱,您的可能是default),修改成對應的名稱即可
4.打開MPLAB X IDE,點擊MCC ICON.


我解決問題了,是用您說的,到configurations.xml將"舊configurations名稱"用"新configurations名稱"取代掉。
感謝您。
但我好奇的是為什麼他有些有改到名稱但又有些沒有改,就是沒有改到的那些無法參考到正確路徑。

我會用多個configurations是因為有的專案有bootloader,我想用configurations去讀不同的ld檔案來燒錄。然後再用相同的概念來exclude檔案(因為我想在用simulator的時後不要執行_on_bootstrap,我有使用classb的自檢)。

總之非常感謝您解決我的問題。

發表於: 2023/4/22 16:12
頂部


關於mcc的generate code
#6
初級會員
初級會員


原先我使用預設configuration(名稱為default)來generate code都可以順利編譯,
程式逐漸龐大後我創建多個configuration,也把當初的default重新命名,在這樣編譯下也都可以編譯完成。
但當我使用非default來generate code後原先mcc創建的檔案路徑開始搜尋不到。
出現 fatal error: definitions.h: No such file or directory、fatal error: device.h: No such file or directory。
但當我再把configuration名稱改回default後再重新generate code又可以搜尋到並編譯成功。
請問有先進知道在改名configuration後設定如何修改才能在連到正確的路徑嗎?

發表於: 2023/4/12 17:28
頂部


Re: pic32mk的HLVD功能
#7
初級會員
初級會員


感謝KevinLu的回覆, 以下是我的步驟

我先在我的初始化那邊加入以下程式
#ifndef __MPLAB_DEBUGGER_SIMULATOR
    
while ((HLVDCON _HLVDCON_BGVST_MASK) != (_HLVDCON_BGVST_MASK))
        ;
#endif
    
HLVDCONCLR _HLVDCON_VDIR_MASK;                   // Event occurs when voltage equals or falls below trip point
    
HLVDCONSET = (0b0110) << _HLVDCON_HLVDL_POSITION;  // 3.0V
    
HLVDCONCLR _HLVDCON_SIDL_MASK;
    
HLVDCONSET _HLVDCON_ON_MASK;


然後在interrupt.c那邊加入
void __attribute__((nomips16)) _nmi_handler(void) {
    
uint32_t getRNMICON RNMICON;
    
SYSKEY              0x00000000;
    
SYSKEY              0xAA996655;
    
SYSKEY              0x556699AA;

  ...

    if ((
getRNMICON _RNMICON_HLVD_MASK) == _RNMICON_HLVD_MASK) {
        
// Programmable High/Low-Voltage Detect
        
EEPROM_WordWrite(0x7000x87);
        
char          timestamp[16];
        
uart_buffer_t uartMessage = {};
        
formatString_Timestamp(timestamp);
        
sprintf(uartMessage.data,                      //
                
"rn%sRNMICON = 0x%08X;(%s:%d)rn",  //
                
timestamp,                             //
                
RNMICON,                               //
                
__FILE__,                              //
                
__LINE__);
        
uartMessage.len strlen(uartMessage.data);
        
UART_PushTxQueue(UART_6, &uartMessage);
        
RNMICONCLR _RNMICON_HLVD_MASK;
    }

    ...

    
SYSKEY 0x33333333;
    
asm volatile("eret");  // return from interrupt
}


我在我的按鈕那邊強制觸發HLVD
void Debounce_Tasks(void) {
    static 
bool flagChecked[DEBOUNCE_PIN_MAX];
    
bool        flagDebugMessage false;
    
getInputPin();

    for (
size_t pinIndex 0pinIndex DEBOUNCE_PIN_MAXpinIndex++) {
        if (
object[pinIndex].pinSetting.pullState == PULL_STATE_NONE) {
            
// 設置浮接的輸入腳不偵測
            
if (flagChecked[pinIndex] == false) {
                
flagChecked[pinIndex] = true;
                
flagDebugMessage      true;
            }
            
Nop();
        } else {
            if (
object[pinIndex].pinSetting.input == object[pinIndex].pinTriggerCondition) {
                if (
object[pinIndex].pinState != PIN_STATE_PRESSED) {
                    if ((
object[pinIndex].timer[DEBOUNCE_TIMER_PRESS] + >= BOUNCE_TIME)) {
                        
object[pinIndex].pinState PIN_STATE_PRESSED;
                        if (
pinIndex == DEBOUNCE_PIN_SWITCH_2) {
#ifndef __MPLAB_DEBUGGER_SIMULATOR
                            
ramStart[0] = BTL_TRIGGER_PATTERN;
                            
ramStart[1] = BTL_TRIGGER_PATTERN;
                            
ramStart[2] = BTL_TRIGGER_PATTERN;
                            
ramStart[3] = BTL_TRIGGER_PATTERN;
                            while (
UART5_WriteIsBusy())
                                ;
                            
formatString_Timestamp(timestamp);
                            
sprintf(uartMessage.data,                    //
                                    
"rn%sEntering Bootloader...rn",  //
                                    
timestamp                            //
                            
);
                            
uartMessage.len strlen(uartMessage.data);
                            
UART5_Write(uartMessage.datauartMessage.len);
                            while (
UART5_TransmitComplete() != true)
                                ;
                            
SYS_RESET_SoftwareReset();
#endif
                        
}
                        if (
pinIndex == DEBOUNCE_PIN_SWITCH_3) {
#ifndef __MPLAB_DEBUGGER_SIMULATOR
                            
formatString_Timestamp(timestamp);
                            
sprintf(uartMessage.data,                              //
                                    
"rn%sRNMICONSET = _RNMICON_HLVD_MASK;rn",  //
                                    
timestamp                                      //
                            
);
                            
uartMessage.len strlen(uartMessage.data);
                            
UART_PushTxQueue(UART_6, &uartMessage);

                            
SYSKEY     0x00000000;
                            
SYSKEY     0xAA996655;
                            
SYSKEY     0x556699AA;
                            
RNMICONSET _RNMICON_HLVD_MASK;
                            
SYSKEY     0x33333333;
                            
formatString_Timestamp(timestamp);
                            
sprintf(uartMessage.data,                      //
                                    
"rn%sRNMICON = 0x%08X;(%s:%d)rn",  //
                                    
timestamp,                             //
                                    
RNMICON,                               //
                                    
__FILE__,                              //
                                    
__LINE__);
                            
uartMessage.len strlen(uartMessage.data);
                            
UART_PushTxQueue(UART_6, &uartMessage);
#endif
                        
}

                        
flagDebugMessage true;
                    } else {
                        
object[pinIndex].timer[DEBOUNCE_TIMER_PRESS]++;
                    }
                }
                
object[pinIndex].timer[DEBOUNCE_TIMER_RELEASE] = 0;
            } else {
                if (
object[pinIndex].pinState != PIN_STATE_RELEASED) {
                    if (
object[pinIndex].timer[DEBOUNCE_TIMER_RELEASE] + >= BOUNCE_TIME) {
                        
object[pinIndex].pinState PIN_STATE_RELEASED;
                        
flagDebugMessage          true;
                    } else {
                        
object[pinIndex].timer[DEBOUNCE_TIMER_RELEASE]++;
                    }
                }
                
object[pinIndex].timer[DEBOUNCE_TIMER_PRESS] = 0;
            }
        }
        if (
flagDebugMessage) {
            
flagDebugMessage false;
            
formatString_Debounce(object[pinIndex].pinStatepinIndex);
        }
    }
}


我進Debug看, 我始終沒有進入過NMI, 然後我就在while加入polling RNMICON
if ((RNMICON _RNMICON_HLVD_MASK) == _RNMICON_HLVD_MASK) {
            
// Programmable High/Low-Voltage Detect
            
SYSKEY 0x00000000;
            
SYSKEY 0xAA996655;
            
SYSKEY 0x556699AA;
            
formatString_Timestamp(timestamp);
            
sprintf(uartMessage.data,                      //
                    
"rn%sRNMICON = 0x%08X;(%s:%d)rn",  //
                    
timestamp,                             //
                    
RNMICON,                               //
                    
__FILE__,                              //
                    
__LINE__);
            
uartMessage.len strlen(uartMessage.data);
            
UART_PushTxQueue(UART_6, &uartMessage);

            
RNMICONCLR _RNMICON_HLVD_MASK;
            
SYSKEY     0x33333333;
        }


這樣我可以強制舉旗RNMICON->HLVD, 但無法舉旗HLVDCON->HLEVT, 我猜是HLVD沒有被開啟, 但也沒有PMD使它開啟

以上是我測試的方法, 但我都沒有辦法觸發HLVD與進入NMI.

發表於: 2022/11/4 16:45
頂部


pic32mk的HLVD功能
#8
初級會員
初級會員


使用的晶片是pic32mk_mcm系列, 根據datasheet中32.0 HIGH/LOW-VOLTAGE DETECT(HLVD)有提到參考"DS60001408"這份文件.
在Section 38. High/Low-Voltage Detect (HLVD)[DS60001408]中的38.3.1 HLVD Setup(page. 6)所提到的步驟,
"5. Clear the HLVD Interrupt Flag in the Interrupt Controller, which may have been set from a
previous interrupt. Refer to the “Interrupts” chapter in the specific device data sheet for
HLVD interrupt-related information."

我翻片datasheet找不到相關的中斷旗標、設置方式, 甚至手動設置RNMICONSET = _RNMICON_HLVD_MASK
也無法進入NMI、讓HLEVT舉旗.

請問是否有先進使用過HLVD, 可以指導、交流 謝謝

發表於: 2022/11/1 13:11
頂部


pic32燒錄時非揮發性記憶體的保留設定
#9
初級會員
初級會員


關於PIC32MK 或 PIC32系列 "非揮發性"記憶體在燒錄時的保留設定問題,
我在PIC18某些晶片的專案體下Properties可以設定Preserve EEPROM Memory Range,
但在PIC32MK這專案體下找不到該設定可以設定,
還是說要使用NVM來保存,如果是的話,它的位置怎麼映射到Program Memory?

發表於: 2022/8/12 8:31
頂部


Re: 關於IEC60730 Class B的自我檢測
#10
初級會員
初級會員


詢問後還是要從2010年, 官方提供的api著手更改。

另外想請問,我這邊透過pic32mz系列,使用MHC產生CLASS B的函式庫。
其中的"CLASSB_FLASH_CRC32_ADDR"這個地址我在PDF、ld檔等資訊一直無法比對出關聯性。
請問這個地址該如何產生呢?

另外在該範例中,SRAM為甚麼是在KSEG1的0xA0000000而不是KSEG0的0x00000000,以及他的測試長度為什麼是65536還不是整段空間?

以上再請協助理解 謝謝

發表於: 2022/7/28 11:33
頂部



(1) 2 3 4 »



:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
https://page.microchip.com/APAC-PrefCenters-TW.html
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------