bootloader pic32MX795F512L
Répondre à la discussion
Page 1 sur 2 1 DernièreDernière
Affichage des résultats 1 à 30 sur 38

bootloader pic32MX795F512L



  1. #1
    davidif

    bootloader pic32MX795F512L


    ------

    Bonjour,

    je souhaite utiliser le bootloader sur mon pic32 starter kit ethernet et ne connaissant pas trop la procédure j'ai essayé de faire selon ce que j'ai pu comprendre sur les demo microchip, s'est à dire :

    j'ai donc ouvert le projet mplabX "USB_HID_Btl_StarterKit.X" je les chargé dans mon kit, ce qui s'est plutôt bien passé au vu de la led vert qui clignote suite à la programmation de ma carte puis j'utilise donc l'interface microchip PIC32UBL.exe pour me connecter , je charge ensuite mon fichier .HEX que je programme a priori bien et j'ai donc toujours cette led verte qui clignotte seulement après je n'ai pas d'info sur comment faire fonctionner le programme que je viens de charger.

    Dans une faq on parle de R17 ET R18 , mais là j'ai pas bien compris


    Merci pour votre aide à ce sujet

    -----

  2. #2
    davidif

    Re : bootloader pic32MX795F512L

    Quelqu'un pourrai me dire si la procédure est loin de ce qu'il faut faire

    merci

  3. #3
    davidif

    Re : bootloader pic32MX795F512L

    Toujours pour le même objectif que je tente difficilement de faire, j'ai donc importé mon programme MPLAB ide V8.90 sous MpalbX et celui-ci ce compile bien et ce trouve être fonctionnel, en premier lieu j'ajoute le fichier linker "btl_32MX795F512L_generic. ld" dans le répertoire correspondant de mon soft et là comprend pas je me trouve avec c'est erreur :

    Code:
    c:/program files (x86)/microchip/xc32/v1.21/bin/../lib/gcc/pic32mx/4.5.2/../../../../pic32mx/bin/ld.exe: Warning: usb_device.o of ..\objects\PIC32_ESK_USB_Device_CDC_DEMO_wo_MAL.a needs to be compiled with MPLAB XC32.
    c:/program files (x86)/microchip/xc32/v1.21/bin/../lib/gcc/pic32mx/4.5.2/../../../../pic32mx/bin/ld.exe: Warning: usb_function_cdc.o of ..\objects\PIC32_ESK_USB_Device_CDC_DEMO_wo_MAL.a needs to be compiled with MPLAB XC32.
    nvm_erase_page_lib.o: Link Error: Could not allocate section .text.NVMErasePage, size = 44 bytes, attributes = code 
    int_tbl_lib.o: Link Error: Could not allocate section .text.INTClearFlag, size = 40 bytes, attributes = code 
    int_tbl_lib.o: Link Error: Could not allocate section .text.INTSetFlag, size = 40 bytes, attributes = code 
    int_tbl_lib.o: Link Error: Could not allocate section .text.INTGetFlag, size = 40 bytes, attributes = code 
    int_tbl_lib.o: Link Error: Could not allocate section .text.INTGetEnable, size = 40 bytes, attributes = code 
    int_restore_interrupts_lib.o: Link Error: Could not allocate section .text.INTRestoreInterrupts, size = 28 bytes, attributes = code 
    pcache.o: Link Error: Could not allocate section .text.CheKseg0CacheOff, size = 24 bytes, attributes = code 
    pcache.o: Link Error: Could not allocate section .text.CheKseg0CacheOn, size = 24 bytes, attributes = code 
    default-nmi-handler.o: Link Error: Could not allocate section .text, size = 24 bytes, attributes = code 
    default-bootstrap-exception-handler.o: Link Error: Could not allocate section .text._bootstrap_exception_handler, size = 12 bytes, attributes = code 
    default-general-exception-handler.o: Link Error: Could not allocate section .text._general_exception_handler, size = 12 bytes, attributes = code 
    int_disable_interrupts_lib.o: Link Error: Could not allocate section .text.INTDisableInterrupts, size = 8 bytes, attributes = code 
    default-on-reset.o: Link Error: Could not allocate section .text._on_reset, size = 8 bytes, attributes = code 
    default-on-bootstrap.o: Link Error: Could not allocate section .text._on_bootstrap, size = 8 bytes, attributes = code 
     Link Error: Could not allocate program memory
    collect2: ld returned 1 exit status
    make[2]: *** [dist/default/production/generic.X.production.hex] Error 1
    make[1]: *** [.build-conf] Error 2
    make: *** [.build-impl] Error 2
    
    BUILD FAILED (exit value 2, total time: 5s)
    d'après ce que je comprend le compilateur souhaite utiliser XC32 pour la compilation de "PIC32_ESK_USB_Device_CDC_DEMO _wo_MAL.a" alors que mplabx est configuré avec xc32.

    Je n'arrive pas a utilisé de fichier linker.

    s'il vous plait je fait actuellement du surplace, si quelqu'un pouvait m'aider
    Merci

  4. #4
    gofio79

    Re : bootloader pic32MX795F512L

    Bonjour,
    Peut tu mettre les fichiers linker (.ld) du bootloader et de ton programme principale?

    Si tu as importer ton projet de MPLAB IDE, as tu pensé à ajouter
    Code:
    OPTIONAL("libmchp_peripheral.a")
    OPTIONAL("libmchp_peripheral_32MX795F512L.a")
    après la ligne suivante dans tes fichiers linker
    Code:
    INPUT("processor.o")
    Je pense aussi que tu n'as pas assez alloué de place pour ton programme. (kseg0_program_mem).

  5. A voir en vidéo sur Futura
  6. #5
    davidif

    Re : bootloader pic32MX795F512L

    Merci de ton aide gofio79, j'ai rajouté ce que tu m'as dis mais j'ai toujours des erreurs, je t'avoue que là je suis un peu dans l'inconnu.

    Code:
    /*************************************************************************
     * Processor-specific object file.  Contains SFR definitions.
     *************************************************************************/
    INPUT("processor.o")
    
    OPTIONAL("libmchp_peripheral.a")
    OPTIONAL("libmchp_peripheral_32MX795F512L.a")
    //OPTIONAL("PIC32_ESK_USB_Device_CDC_DEMO_wo_MAL.a")
    
    /*************************************************************************
     * For interrupt vector handling
     *************************************************************************/
    PROVIDE(_vector_spacing = 0x00000001);
    _ebase_address = 0x9FC01000;
    
    /*************************************************************************
     * Memory Address Equates
     * _RESET_ADDR      -- Reset Vector
     * _BEV_EXCPT_ADDR  -- Boot exception Vector
     * _DBG_EXCPT_ADDR  -- In-circuit Debugging Exception Vector
     * _DBG_CODE_ADDR   -- In-circuit Debug Executive address
     * _DBG_CODE_SIZE   -- In-circuit Debug Executive size
     * _GEN_EXCPT_ADDR  -- General Exception Vector
     *************************************************************************/
    _RESET_ADDR              = 0xBFC00000;
    _BEV_EXCPT_ADDR          = 0xBFC00380;
    _DBG_EXCPT_ADDR          = 0xBFC00480;
    _DBG_CODE_ADDR           = 0xBFC02000;
    _DBG_CODE_SIZE           = 0xFF0     ;
    _GEN_EXCPT_ADDR          = _ebase_address + 0x180;
    
    /*************************************************************************
     * Memory Regions
     *
     * Memory regions without attributes cannot be used for orphaned sections.
     * Only sections specifically assigned to these regions can be allocated
     * into these regions.
     *************************************************************************/
    MEMORY
    {
      kseg0_program_mem    (rx)  : ORIGIN = 0x9D000000, LENGTH = 0x80000
      kseg0_boot_mem             : ORIGIN = 0x9FC00490, LENGTH = 0x970
      exception_mem              : ORIGIN = 0x9FC01000, LENGTH = 0x1000
      kseg1_boot_mem             : ORIGIN = 0xBFC00000, LENGTH = 0x490
      debug_exec_mem             : ORIGIN = 0xBFC02000, LENGTH = 0xFF0
      config3                    : ORIGIN = 0xBFC02FF0, LENGTH = 0x4
      config2                    : ORIGIN = 0xBFC02FF4, LENGTH = 0x4
      config1                    : ORIGIN = 0xBFC02FF8, LENGTH = 0x4
      config0                    : ORIGIN = 0xBFC02FFC, LENGTH = 0x4
      kseg1_data_mem       (w!x) : ORIGIN = 0xA0000000, LENGTH = 0x20000
      sfrs                       : ORIGIN = 0xBF800000, LENGTH = 0x100000
      configsfrs                 : ORIGIN = 0xBFC02FF0, LENGTH = 0x10
    }
    
    /*************************************************************************
     * Configuration-word sections
     *************************************************************************/
    SECTIONS
    {
      .config_BFC02FF0 : {
        KEEP(*(.config_BFC02FF0))
      } > config3
      .config_BFC02FF4 : {
        KEEP(*(.config_BFC02FF4))
      } > config2
      .config_BFC02FF8 : {
        KEEP(*(.config_BFC02FF8))
      } > config1
      .config_BFC02FFC : {
        KEEP(*(.config_BFC02FFC))
      } > config0
    }
    Les erreurs

    Code:
    Executing: "C:\Program Files (x86)\Microchip\MPLAB C32 Suite\bin\pic32-gcc.exe" -mprocessor=32MX795F512L "objects\main.o" "objects\fonction.o" "objects\usb_descriptors.o" "objects\usb.o" "objects\Flash.o" "C:\Users\Portable\Google Drive\Professionnel\etude\hardware\Programme PIC32\Géneric\Généric6\objects\PIC32_ESK_USB_Device_CDC_DEMO_wo_MAL.a" "C:\Program Files (x86)\Microchip\MPLAB C32 Suite\pic32mx\lib\libmchp_peripheral_32MX795F512L.a" -o".\objects\generic.elf" -Wl,-L"C:\Program Files (x86)\Microchip\MPLAB C32 Suite\lib",--script="..\..\..\..\..\..\..\..\..\Program Files (x86)\Microchip\MPLAB C32 Suite\pic32mx\lib\proc\32MX795F512L\procdefs.ld",--defsym=__MPLAB_BUILD=1,-Map=".\objects\generic.map"
    c:/program files (x86)/microchip/mplab c32 suite/bin/../lib/gcc/pic32mx/4.5.1/../../../../pic32mx/bin/ld.exe:..\..\..\..\..\..\..\..\..\Program Files (x86)\Microchip\MPLAB C32 Suite\pic32mx\lib\proc\32MX795F512L\procdefs.ld:6: syntax error
    collect2: ld returned 1 exit status
    Link step failed.
    ----------------------------------------------------------------------
    Release build of project `C:\Users\Portable\Google Drive\Professionnel\etude\hardware\Programme PIC32\Géneric\Généric6\generic.mcp' failed.
    Language tool versions: pic32-as.exe v2.02, pic32-gcc.exe v2.02, pic32-ld.exe v2.02, pic32-ar.exe v2.02
    Tue Dec 03 18:13:31 2013
    ----------------------------------------------------------------------
    BUILD FAILED
    J'ai pourtant rien véritablement définit comme espace pour mon programme avant d'y mettre le fichier linker, j'ai simplement fait mon soft sans me soucier de l'espace mémoire, seulement maintenant afin de maitriser cette espace je souhaitai inclure mon fichier avec évidemment comme objectif d'y programmer un bootloader, quelque choses dont pour le moment je ne maîtrise pas du tout, je dirais même plus je patauge
    Images attachées Images attachées  
    Dernière modification par davidif ; 03/12/2013 à 17h25.

  7. #6
    gofio79

    Re : bootloader pic32MX795F512L

    Utilises tu l'example de bootloader de microchip?
    Tu utilise bien MPLAB X? Quel version de compilateur?

    J'image que ce fichier linker est celui pour le bootloader?
    Le problème déjà est que la taille de kseg0_program_mem est beaucoup trop grand. Il ne te restera plus de place pour ton programme principale. Tu réserve les 512KB pour le bootloader donc plus de place pour ton futur programme.
    Donc déjà diminue ta length de kseg0_program_mem.

    Est ce que c'est ton seul fichier linker?

  8. #7
    gofio79

    Re : bootloader pic32MX795F512L

    Alors en fait, tu utilise le compilateur C32. en v2.02 à ce que j'ai vu sur ta capture d'écran de compilation.
    Donc tu peux supprimer ce que je t'ai dit de rajouter. (OPTIONNAL .....)

    Ensuite copie ça au tout début de ton fichier linker :
    Code:
    /* 
     Mapping Note: The IVT and C Start-up code of the bootloader is mapped in the boot Flash.
           		   Rest of the bootloader is mapped in the program Flash from address 0x9D000000 to 0x9D004FFF.
           		   The user application code must be mapped from the address 0x9D005000 to end of the program Flash. */
    
    /* Default linker script, for normal executables */
    OUTPUT_FORMAT("elf32-tradlittlemips")
    OUTPUT_ARCH(pic32mx)
    ENTRY(_reset)
    /*
     * Provide for a minimum stack and heap size
     * - _min_stack_size - represents the minimum space that must be made
     *                     available for the stack.  Can be overridden from
     *                     the command line using the linker's --defsym option.
     * - _min_heap_size  - represents the minimum space that must be made
     *                     available for the heap.  Can be overridden from
     *                     the command line using the linker's --defsym option.
     */
    EXTERN (_min_stack_size _min_heap_size)
    PROVIDE(_min_stack_size = 0x400) ;
    PROVIDE(_min_heap_size = 0) ;
    Puis rajoute ça :
    Code:
    _ramfunc_begin = 0;
    à la place de OPTIONNAL ..... que tu viens de supprimer.

    Ensuite tu dois copier à la fin du fichier ce que je met dans le prochain post car j'ai plus assez de place dans ce message.

  9. #8
    gofio79

    Re : bootloader pic32MX795F512L

    Je ne peux pas mettre tout ce qui te manque donc je vais te mettre mon fichier directement.
    bootloader_ld.txt

    Copie tout à partir de
    Code:
    PROVIDE(_DBG_CODE_ADDR = 0xBFC02000) ;
    PROVIDE(_DBG_CODE_SIZE = 0xFF0) ;
    Jusqu’à la fin du fichier. Et colle le à la fin de ton fichier.
    Ensuite ressaye de compiler.

    EDIT : Mon fichier est pour XC32 donc moi j'ai le OPTIONNAL ....

  10. #9
    davidif

    Re : bootloader pic32MX795F512L

    Merci gofio79 je vais faire ça, j'ai eu quelques complication sur mon projet a force de modifier et retirer des choses je n'arrivais plus du tout à compiler et j'ai dû revenir sur une ancienne version de mon projet, n'arrivant pas à comprendre ce qui s'est passer, maintenant tout est revenu dans l'ordre et je vais pouvoir suivre tes conseils.

    Par contre effectivement comme tu as constaté je tes mis des impressions d'écrans de mplab ide V8, seulement il m'arrive de passer sous mplabx(xc32) afin d'essayer de l'apprivoisé aux quel cas , la différence c'est optionnal ? si je met ça qu'est ce que je met pas ?

    Merci

  11. #10
    davidif

    Re : bootloader pic32MX795F512L

    Bon Bah , en fait sous mpalx j'ai repris ton fichier entièrement pour le moment et ça compile ok

    Merci gofio79

  12. #11
    gofio79

    Re : bootloader pic32MX795F512L

    Content que ce soit résolu.
    Sinon, la différence entre le fichier linker en XC32 et en C32 est juste le OPTIMAL (dans le XC32) sinon rien à enlever ou a rajouter d'autre.

    Par contre il faudra que tu fasse aussi un fichier linker pour ton programme principal. Qui aura des adresses différentes.
    Voici la partie qui va changer dans ton linker.
    En fait, il faut que la première adresse à la suite de ton bootloader soit la section exception (qui est la ebase_adress). Puis tu met à la suite le kseg0_boot_mem et le kseg1_boot_mem.
    Puis tu met à la fin, ton programme principale qui prend le reste de la place (ce que je n'ai d'ailleurs pas fait).(donc 0x80000 - 0x7000 - 0x1000 - 0x970 - 0x490). Cela doit marche normalement.
    Enfin déjà essaye ça et puis tu verra si ça compile et si tu arrive à le programme via le bootloader.


    Code:
    /*************************************************************************
     * For interrupt vector handling
     *************************************************************************/
    PROVIDE(_vector_spacing = 0x00000001);
    _ebase_address  = 0x9D007000;
    
    /*************************************************************************
     * Memory Address Equates
     *************************************************************************/
    _RESET_ADDR              = (0x9D007000 + 0x1000 + 0x970);
    _BEV_EXCPT_ADDR          = (0x9D007000 + 0x1000 + 0x970 + 0x380);
    _DBG_EXCPT_ADDR          = (0x9D007000 + 0x1000 + 0x970 + 0x480);
    _DBG_CODE_ADDR           = 0xBFC02000;
    _DBG_CODE_SIZE           = 0xFF0     ;
    _GEN_EXCPT_ADDR          = _ebase_address + 0x180;
    
    /*************************************************************************
     * Memory Regions
     *
     * Memory regions without attributes cannot be used for orphaned sections.
     * Only sections specifically assigned to these regions can be allocated
     * into these regions.
     *************************************************************************/
    MEMORY
    {
      kseg0_program_mem    (rx)  : ORIGIN = (0x9D007000 + 0x1000 + 0x970 + 0x490), 				LENGTH = 0x60000
      kseg0_boot_mem             : ORIGIN = (0x9D007000 + 0x1000), 								LENGTH = 0x970
      exception_mem              : ORIGIN =  0x9D007000, 										LENGTH = 0x1000 /* Dummy IVT to fool the linker. This code uses no ISR*/
    
      kseg1_boot_mem             : ORIGIN = (0x9D007000 + 0x1000 + 0x970), 						LENGTH = 0x490
    
      debug_exec_mem             : ORIGIN = 0xBFC02000, LENGTH = 0xFF0
      config3                    : ORIGIN = 0xBFC02FF0, LENGTH = 0x4
      config2                    : ORIGIN = 0xBFC02FF4, LENGTH = 0x4
      config1                    : ORIGIN = 0xBFC02FF8, LENGTH = 0x4
      config0                    : ORIGIN = 0xBFC02FFC, LENGTH = 0x4
      kseg1_data_mem       (w!x) : ORIGIN = 0xA0000000, LENGTH = 0x18000
      sfrs                       : ORIGIN = 0xBF800000, LENGTH = 0x10000
      configsfrs                 : ORIGIN = 0xBFC02FF0, LENGTH = 0x10
    }

  13. #12
    davidif

    Re : bootloader pic32MX795F512L

    Ha ok , je pensais il fallait qu'un seul fichier linker.
    En fait, il faut un pour le bootloader et un pour le programme principal, ok je vois ça.

    J'essai d'adapter mon projet en exemple du prog bootloader de microchip
    C:\AN1388_Source_Code_2013_02_ 01\PIC32_Bootloaders\Firmware\ Bootloader

    je sais pas si c'est la bonne méthode ?

    MERCI pour tes infos j'essai ce que tu me dis de faire

  14. #13
    gofio79

    Re : bootloader pic32MX795F512L

    Tu as bien compris qu'il te faut aussi deux projet distinct?
    Un projet bootloader et un projet pour ton programme principal.

    Moi aussi je suis partie de l'AN1388 qui est pas trop mal pour débuter.

    A noter aussi que j'ai oublié de te dire. Très important dans le fichier Bootloader.h de l'example. Il faut bien que tu pense à mettre l'adresse USER_APP_RESET_ADDRESS à la valeur de _RESET_ADDR de ton linker de ton programme principal. Donc pour l'exemple que je t'ai donné le USER_APP_RESET_ADDRESS sera de (0x9D007000 + 0x1000 + 0x970).
    Si ce n'est pas au bon endroit, ton programme ne démarrera jamais.
    En fait, c'est l'adresse à laquelle le bootloader va lancer ton programme principal.
    Dans le même genre pense à changer également ton APP_FLASH_BASE_ADDRESS qui doit être également à l'ORIGINE de ton exception_mem.

    Voilà sinon cela devrait fonctionner.

  15. #14
    davidif

    Re : bootloader pic32MX795F512L

    OK, alors en fait tu fais bien de me le préciser effectivement pour le faîte qu'il fasse deux projets distant par ce que je pensais qu'il fallait adapter mon projet principal pour pouvoir booter dessus au moment ou je souhaite faire un update et ainsi charger le nouveau soft, donc là je me plantait alors.

    En fait, j'ai deux projets un principal et un bootloader, mais c'est là ou je ne comprend pas, lequel deux deux je charge dans ma carte, par ce qu'au départ je charge bien mon programme principal puis après quand j'ai besoin de faire un update je rechargerai mon programme principal évolué.

    Merci pour tes précision

  16. #15
    davidif

    Re : bootloader pic32MX795F512L

    Ha bah ok, autant pour moi , en fait on charge d'abord le programme bootloader puis avec l'utilitaire Microchip tu viens charger le fichier hex du programme principal et il suffit de redémarrer pour que le programme s'exécute.

    Je vois ça demain et encore merci pour ton aide par ce que là j'étais à l'ouest

  17. #16
    gofio79

    Re : bootloader pic32MX795F512L

    Oui voilà.
    Il faut que tu charge ton programme bootloader dans ton PIC (via mplab). Ensuite quand ton bootloader est chargé tu n'as plus besoin du programmateur mirochip (ICD3, RealICE, ...). Tu n'utilise plus que le logiciel sur PC de microchip.

    Par contre il faut bien que tu laisse dans ton programme bootloader les fonctions pour discuter avec le PC via ethernet, USB ou serie (il me semble). Garde que celui qui t'intéresse pour optimiser l'espace mémoire utilisée par ton bootloader et donc gagner de la place dans la flash pour ton programme principal.

    Mais par exemple si tu veut changer ton programme bootloader de ton PIC tu devras repasser par le programmateur (ICD3, RealICE, ...) car le bootloader livré par microchip ne se reflashe pas lui même.

  18. #17
    davidif

    Re : bootloader pic32MX795F512L

    Par contre gofio79, j'ai dû mal m'exprimer, car au départ de mon sujet je ne percevais pas trop la manip et en fait au post 5 ce que j'ai mis comme fichier linker était celui du programme principal, c'est pour ça que ta vu tant d'espace pour mon programme principal et non pas celui du programme bootloader.

    En te relisant j'ai réalisé quand fait, mon programme principal passait, par ce que j'avais copié et collé ton fichier linker que tu m'a joint et je les mis dans mon linker de programme principal alors qu'il était destiné au projet bootloader.

    J'ai donc repris le linker de mon programme principal d'origine du poste 5 et celui-ci ne passe effectivement pas, je rien modifier dessus et repris celui de microchip.

    qu'est ce qui manque donc ou a modifier sur le linker du programme principal ?

    Excuse moi, maintenant grâce à tes explication j'ai compris le principe globale seulement j'ai du mal à distinguer ce que je fais sur le fichier linker bootloader et le linker programme principale.

    Faut que je te relise, pour séparer les modifications que l'on fait sur l'un et l'autre des linkers

    là j'ai le linker du programme principal
    Code:
    /*************************************************************************
     * Processor-specific object file.  Contains SFR definitions.
     *************************************************************************/
    INPUT("processor.o")
    
    /*************************************************************************
     * Processor-specific peripheral libraries are optional
     *************************************************************************/
    OPTIONAL("libmchp_peripheral.a")
    OPTIONAL("libmchp_peripheral_32MX795F512L.a")
    
    /*************************************************************************
     * For interrupt vector handling
     *************************************************************************/
    PROVIDE(_vector_spacing = 0x00000001);
    _ebase_address = 0x9FC01000;
    
    /*************************************************************************
     * Memory Address Equates
     * _RESET_ADDR      -- Reset Vector
     * _BEV_EXCPT_ADDR  -- Boot exception Vector
     * _DBG_EXCPT_ADDR  -- In-circuit Debugging Exception Vector
     * _DBG_CODE_ADDR   -- In-circuit Debug Executive address
     * _DBG_CODE_SIZE   -- In-circuit Debug Executive size
     * _GEN_EXCPT_ADDR  -- General Exception Vector
     *************************************************************************/
    _RESET_ADDR              = 0xBFC00000;
    _BEV_EXCPT_ADDR          = 0xBFC00380;
    _DBG_EXCPT_ADDR          = 0xBFC00480;
    _DBG_CODE_ADDR           = 0xBFC02000;
    _DBG_CODE_SIZE           = 0xFF0     ;
    _GEN_EXCPT_ADDR          = _ebase_address + 0x180;
    
    /*************************************************************************
     * Memory Regions
     *
     * Memory regions without attributes cannot be used for orphaned sections.
     * Only sections specifically assigned to these regions can be allocated
     * into these regions.
     *************************************************************************/
    MEMORY
    {
      kseg0_program_mem    (rx)  : ORIGIN = 0x9D000000, LENGTH = 0x80000
      kseg0_boot_mem             : ORIGIN = 0x9FC00490, LENGTH = 0x970
      exception_mem              : ORIGIN = 0x9FC01000, LENGTH = 0x1000
      kseg1_boot_mem             : ORIGIN = 0xBFC00000, LENGTH = 0x490
      debug_exec_mem             : ORIGIN = 0xBFC02000, LENGTH = 0xFF0
      config3                    : ORIGIN = 0xBFC02FF0, LENGTH = 0x4
      config2                    : ORIGIN = 0xBFC02FF4, LENGTH = 0x4
      config1                    : ORIGIN = 0xBFC02FF8, LENGTH = 0x4
      config0                    : ORIGIN = 0xBFC02FFC, LENGTH = 0x4
      kseg1_data_mem       (w!x) : ORIGIN = 0xA0000000, LENGTH = 0x20000
      sfrs                       : ORIGIN = 0xBF800000, LENGTH = 0x100000
      configsfrs                 : ORIGIN = 0xBFC02FF0, LENGTH = 0x10
    }
    
    /*************************************************************************
     * Configuration-word sections
     *************************************************************************/
    SECTIONS
    {
      .config_BFC02FF0 : {
        KEEP(*(.config_BFC02FF0))
      } > config3
      .config_BFC02FF4 : {
        KEEP(*(.config_BFC02FF4))
      } > config2
      .config_BFC02FF8 : {
        KEEP(*(.config_BFC02FF8))
      } > config1
      .config_BFC02FFC : {
        KEEP(*(.config_BFC02FFC))
      } > config0
    }

  19. #18
    davidif

    Re : bootloader pic32MX795F512L

    et là le linker du bootloader
    Fichiers attachés Fichiers attachés

  20. #19
    gofio79

    Re : bootloader pic32MX795F512L

    Salut,
    En fait tes fichiers linker servent à définir les emplacements mémoire et la taille des tes programmes (bootloader et programme principal).
    C'est lui qui va dire, en gros, que ton programme est situé en flash, tes données en RAM, que tes interruptions sont situé à tel adresse, ....

    En fait, il te faut deux projet (1 bootloader et 1 principal) car si tu n'en a qu'un, tu ne peux pas flasher un programme sur lequel tu es. Enfin pas facilement en tout cas. C'est comme si t'essayais de bouger un fichier alors qu'il est ouvert. (en simplifiant).

    Donc c'est pour ça que tu as besoin de deux projets. Et donc pour ces deux projets, tu as besoin de deux fichier linker car le programme principal ne peut pas deviner où il faut qu'il commence, quel place il prend, etc. Et idem pour le bootloader. Tu as toujours un fichier linker sauf que pour les projets "normaux", il est transparent pour l'utilisateur.

    Ensuite pour en revenir à ton fichier linker de ton programme principal.
    Créé une copie local de ton fichier linker de ton programme principal. Ensuite copie tout le fichier linker du bootloader. Tu le colles à la place de ce qu'il y a dans le fichier linker du programme principal.
    Ensuite tu colles ça à la place de l'ancienne partie (celle qui indique les adresses du bootloader) du fichier linker du programme principal.
    Code:
    /*************************************************************************
     * For interrupt vector handling
     *************************************************************************/
    PROVIDE(_vector_spacing = 0x00000001);
    _ebase_address  = 0x9D006000;
    
    /*************************************************************************
     * Memory Address Equates
     *************************************************************************/
    _RESET_ADDR              = (0x9D006000 + 0x1000 + 0x970);
    _BEV_EXCPT_ADDR          = (0x9D006000 + 0x1000 + 0x970 + 0x380);
    _DBG_EXCPT_ADDR          = (0x9D006000 + 0x1000 + 0x970 + 0x480);
    _DBG_CODE_ADDR           = 0xBFC02000;
    _DBG_CODE_SIZE           = 0xFF0     ;
    _GEN_EXCPT_ADDR          = _ebase_address + 0x180;
    
    /*************************************************************************
     * Memory Regions
     *
     * Memory regions without attributes cannot be used for orphaned sections.
     * Only sections specifically assigned to these regions can be allocated
     * into these regions.
     *************************************************************************/
    MEMORY
    {
      kseg0_program_mem    (rx)  : ORIGIN = (0x9D006000 + 0x1000 + 0x970 + 0x490), 				LENGTH = (0x80000 - 0x6000 - 0x1000 - 0x970 - 0x490)
      kseg0_boot_mem             : ORIGIN = (0x9D006000 + 0x1000), 								LENGTH = 0x970
      exception_mem              : ORIGIN =  0x9D006000, 										LENGTH = 0x1000 /* Dummy IVT to fool the linker. This code uses no ISR*/
    
      kseg1_boot_mem             : ORIGIN = (0x9D006000 + 0x1000 + 0x970), 						LENGTH = 0x490
    
      debug_exec_mem             : ORIGIN = 0xBFC02000, LENGTH = 0xFF0
      config3                    : ORIGIN = 0xBFC02FF0, LENGTH = 0x4
      config2                    : ORIGIN = 0xBFC02FF4, LENGTH = 0x4
      config1                    : ORIGIN = 0xBFC02FF8, LENGTH = 0x4
      config0                    : ORIGIN = 0xBFC02FFC, LENGTH = 0x4
      kseg1_data_mem       (w!x) : ORIGIN = 0xA0000000, LENGTH = 0x18000
      sfrs                       : ORIGIN = 0xBF800000, LENGTH = 0x10000
      configsfrs                 : ORIGIN = 0xBFC02FF0, LENGTH = 0x10
    }
    Normalement ça devrait marcher.
    Ton bootloader compile bien?
    Pense aussi à verifier que le "OPTIONAL" est bien commenté si tu utilises toujours le compilateur c32.

  21. #20
    davidif

    Re : bootloader pic32MX795F512L

    Citation Envoyé par gofio79 Voir le message
    Puis tu met à la fin, ton programme principale qui prend le reste de la place (ce que je n'ai d'ailleurs pas fait).(donc 0x80000 - 0x7000 - 0x1000 - 0x970 - 0x490). Cela doit marche normalement.
    Enfin déjà essaye ça et puis tu verra si ça compile et si tu arrive à le programme via le bootloader.
    Excuse moi, mais j'ai donc fait le linker du programme principal comme tu me la descrit et ça compile pas.
    Par contre j'ai pas bien compris ou placer ce que tu cite ci-dessus.

    Mon linker programme principal modifié:

    Code:
    /*************************************************************************
     * Processor-specific object file.  Contains SFR definitions.
     *************************************************************************/
    INPUT("processor.o")
    
    /*************************************************************************
     * Processor-specific peripheral libraries are optional
     *************************************************************************/
    OPTIONAL("libmchp_peripheral.a")
    OPTIONAL("libmchp_peripheral_32MX795F512L.a")
    
    /*************************************************************************
     * For interrupt vector handling
     *************************************************************************/
    PROVIDE(_vector_spacing = 0x00000001);
    _ebase_address  = 0x9D007000;
    
    /*************************************************************************
     * Memory Address Equates
     * _RESET_ADDR      -- Reset Vector
     * _BEV_EXCPT_ADDR  -- Boot exception Vector
     * _DBG_EXCPT_ADDR  -- In-circuit Debugging Exception Vector
     * _DBG_CODE_ADDR   -- In-circuit Debug Executive address
     * _DBG_CODE_SIZE   -- In-circuit Debug Executive size
     * _GEN_EXCPT_ADDR  -- General Exception Vector
     *************************************************************************/
    _RESET_ADDR              = (0x9D007000 + 0x1000 + 0x970);
    _BEV_EXCPT_ADDR          = (0x9D007000 + 0x1000 + 0x970 + 0x380);
    _DBG_EXCPT_ADDR          = (0x9D007000 + 0x1000 + 0x970 + 0x480);
    _DBG_CODE_ADDR           = 0xBFC02000;
    _DBG_CODE_SIZE           = 0xFF0     ;
    _GEN_EXCPT_ADDR          = _ebase_address + 0x180;
    
    /*************************************************************************
     * Memory Regions
     *
     * Memory regions without attributes cannot be used for orphaned sections.
     * Only sections specifically assigned to these regions can be allocated
     * into these regions.
     *************************************************************************/
    MEMORY
    {
      kseg0_program_mem    (rx)  : ORIGIN = (0x9D007000 + 0x1000 + 0x970 + 0x490), 	LENGTH = 0x60000
      kseg0_boot_mem             : ORIGIN = (0x9D007000 + 0x1000), 					LENGTH = 0x970
      exception_mem              : ORIGIN =  0x9D007000, 							LENGTH = 0x1000 /* Dummy IVT to fool the linker. This code uses no ISR*/
      kseg1_boot_mem             : ORIGIN = (0x9D007000 + 0x1000 + 0x970), 			LENGTH = 0x490
      debug_exec_mem             : ORIGIN = 0xBFC02000, LENGTH = 0xFF0
      config3                    : ORIGIN = 0xBFC02FF0, LENGTH = 0x4
      config2                    : ORIGIN = 0xBFC02FF4, LENGTH = 0x4
      config1                    : ORIGIN = 0xBFC02FF8, LENGTH = 0x4
      config0                    : ORIGIN = 0xBFC02FFC, LENGTH = 0x4
      kseg1_data_mem       (w!x) : ORIGIN = 0xA0000000, LENGTH = 0x18000
      sfrs                       : ORIGIN = 0xBF800000, LENGTH = 0x100000
      configsfrs                 : ORIGIN = 0xBFC02FF0, LENGTH = 0x10
    }
    
    /*************************************************************************
     * Configuration-word sections
     *************************************************************************/
    SECTIONS
    {
      .config_BFC02FF0 : {
        KEEP(*(.config_BFC02FF0))
      } > config3
      .config_BFC02FF4 : {
        KEEP(*(.config_BFC02FF4))
      } > config2
      .config_BFC02FF8 : {
        KEEP(*(.config_BFC02FF8))
      } > config1
      .config_BFC02FFC : {
        KEEP(*(.config_BFC02FFC))
      } > config0
    }
    j'ai ces erreur là

    Code:
    make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
    make[1]: Entering directory `C:/Users/Portable/Google Drive/Professionnel/etude/hardware/Programme PIC32/G�neric/MPLABX/G�n�ric7/generic.X'
    make  -f nbproject/Makefile-default.mk dist/default/production/generic.X.production.hex
    make[2]: Entering directory `C:/Users/Portable/Google Drive/Professionnel/etude/hardware/Programme PIC32/G�neric/MPLABX/G�n�ric7/generic.X'
    "C:\Program Files (x86)\Microchip\xc32\v1.21\bin\xc32-gcc.exe"   -mprocessor=32MX795F512L  -o dist/default/production/generic.X.production.elf build/default/production/_ext/812168374/main.o build/default/production/_ext/812168374/fonction.o build/default/production/_ext/812168374/usb_descriptors.o build/default/production/_ext/812168374/usb.o build/default/production/_ext/812168374/Flash.o    ..\objects\PIC32_ESK_USB_Device_CDC_DEMO_wo_MAL.a ..\objects\libmchp_peripheral_32MX795F512L.a ..\objects\libmchp_peripheral.a      -Wl,--defsym=__MPLAB_BUILD=1,--script="..\32MX795F512L\procdefs.ld",-L"../../../../../../../../../../../Program Files (x86)/Microchip/MPLAB C32 Suite/lib",-L"..",-Map="dist/default/production/generic.X.production.map"
    c:/program files (x86)/microchip/xc32/v1.21/bin/../lib/gcc/pic32mx/4.5.2/../../../../pic32mx/bin/ld.exe: Warning: usb_device.o of ..\objects\PIC32_ESK_USB_Device_CDC_DEMO_wo_MAL.a needs to be compiled with MPLAB XC32.
    c:/program files (x86)/microchip/xc32/v1.21/bin/../lib/gcc/pic32mx/4.5.2/../../../../pic32mx/bin/ld.exe: Warning: usb_function_cdc.o of ..\objects\PIC32_ESK_USB_Device_CDC_DEMO_wo_MAL.a needs to be compiled with MPLAB XC32.
    c:/program files (x86)/microchip/xc32/v1.21/bin/../lib/gcc/pic32mx/4.5.2/../../../../pic32mx/bin/ld.exe: warning: Sections: .debug_ranges, .debug_pubtypes, and .gnu.attributes should be mapped in the linker script.
    c:/program files (x86)/microchip/xc32/v1.21/bin/../lib/gcc/pic32mx/4.5.2/../../../../pic32mx/bin/ld.exe: small-data section exceeds 64KB; lower small-data size limit (see option -G)
    build/default/production/_ext/812168374/main.o: In function `init_variable':
    C:\Users\Portable\Google Drive\Professionnel\etude\hardware\Programme PIC32\G�neric\MPLABX\G�n�ric7\generic.X/../source/main.c:164: relocation truncated to fit: R_MIPS_GPREL16 against `nbr_led'
    C:\Users\Portable\Google Drive\Professionnel\etude\hardware\Programme PIC32\G�neric\MPLABX\G�n�ric7\generic.X/../source/main.c:165: relocation truncated to fit: R_MIPS_GPREL16 against `ID_VAL'
    C:\Users\Portable\Google Drive\Professionnel\etude\hardware\Programme PIC32\G�neric\MPLABX\G�n�ric7\generic.X/../source/main.c:167: relocation truncated to fit: R_MIPS_GPREL16 against `idx'
    C:\Users\Portable\Google Drive\Professionnel\etude\hardware\Programme PIC32\G�neric\MPLABX\G�n�ric7\generic.X/../source/main.c:168: relocation truncated to fit: R_MIPS_GPREL16 against `val_buff'
    C:\Users\Portable\Google Drive\Professionnel\etude\hardware\Programme PIC32\G�neric\MPLABX\G�n�ric7\generic.X/../source/main.c:169: relocation truncated to fit: R_MIPS_GPREL16 against `Data'
    C:\Users\Portable\Google Drive\Professionnel\etude\hardware\Programme PIC32\G�neric\MPLABX\G�n�ric7\generic.X/../source/main.c:171: relocation truncated to fit: R_MIPS_GPREL16 against `valeur1'
    C:\Users\Portable\Google Drive\Professionnel\etude\hardware\Programme PIC32\G�neric\MPLABX\G�n�ric7\generic.X/../source/main.c:172: relocation truncated to fit: R_MIPS_GPREL16 against `valeur2'
    C:\Users\Portable\Google Drive\Professionnel\etude\hardware\Programme PIC32\G�neric\MPLABX\G�n�ric7\generic.X/../source/main.c:178: relocation truncated to fit: R_MIPS_GPREL16 against `out1_usb'
    C:\Users\Portable\Google Drive\Professionnel\etude\hardware\Programme PIC32\G�neric\MPLABX\G�n�ric7\generic.X/../source/main.c:178: relocation truncated to fit: R_MIPS_GPREL16 against `out1_usb'
    C:\Users\Portable\Google Drive\Professionnel\etude\hardware\Programme PIC32\G�neric\MPLABX\G�n�ric7\generic.X/../source/main.c:182: relocation truncated to fit: R_MIPS_GPREL16 against `out2_usb'
    C:\Users\Portable\Google Drive\Professionnel\etude\hardware\Programme PIC32\G�neric\MPLABX\G�n�ric7\generic.X/../source/main.c:182: additional relocation overflows omitted from the output
    c:/program files (x86)/microchip/xc32/v1.21/bin/../lib/gcc/pic32mx/4.5.2/../../../../pic32mx/lib/crt0.o: In function `_no_nmi':
    libpic32/startup/crt0.S:(.reset.startup+0x28): undefined reference to `_gp'
    libpic32/startup/crt0.S:(.reset.startup+0x2c): undefined reference to `_gp'
    libpic32/startup/crt0.S:(.reset.startup+0x60): undefined reference to `_bss_begin'
    libpic32/startup/crt0.S:(.reset.startup+0x64): undefined reference to `_bss_begin'
    libpic32/startup/crt0.S:(.reset.startup+0x68): undefined reference to `_bss_end'
    libpic32/startup/crt0.S:(.reset.startup+0x6c): undefined reference to `_bss_end'
    collect2: ld returned 1 exit status
    make[2]: Leaving directory `C:/Users/Portable/Google Drive/Professionnel/etude/hardware/Programme PIC32/G�neric/MPLABX/G�n�ric7/generic.X'
    make[1]: Leaving directory `C:/Users/Portable/Google Drive/Professionnel/etude/hardware/Programme PIC32/G�neric/MPLABX/G�n�ric7/generic.X'
    make[2]: *** [dist/default/production/generic.X.production.hex] Error 1
    make[1]: *** [.build-conf] Error 2
    make: *** [.build-impl] Error 2
    
    BUILD FAILED (exit value 2, total time: 1s)

  22. #21
    davidif

    Re : bootloader pic32MX795F512L

    nos deux postes ce son croisés, j'ai envoyé mon dernier poste sans prendre connaissance de ton dernier

  23. #22
    davidif

    Re : bootloader pic32MX795F512L

    ok mon programme principal compile correctement merci encore

  24. #23
    gofio79

    Re : bootloader pic32MX795F512L

    Ok, pas de soucis.
    Tiens moi au courant si ça fonctionne correctement quand tu le programmera.

  25. #24
    davidif

    Re : bootloader pic32MX795F512L

    Bon alors en fait, tout ce compile correctement , je charge donc mon programme bootloader via mpalx ce qui ce passe bien, la led clignote puis après je charge mon programme principale via l'utilitaire microchip "PIC32UBL.exe", connection ok , je vais donc récupérer le fichier hex puis je fais programme, et là ça bloque.

    Une question une fois les modif fait dans le linker du programme principal adapter pour le bootloader, il n'est plus possible de le charger tout seul via mplabx ou on est obligé de passer par le bootloader ?
    Images attachées Images attachées  

  26. #25
    gofio79

    Re : bootloader pic32MX795F512L

    Oui une fois que tu as fait ton fichier linker pour ton programme principal, tu ne peux plus le programmer par bootloader.
    Normalement pour pouvoir reprogrammer ton PIC avec le programme principal, tu peux juste enlever ton fichier linker de ton projet et il fonctionnera "normalement".

    Sinon pour ton problème, tu as juste cela qui est marqué? Pas de message d'erreur? Est ce que ta LED clignote toujours?
    Sinon tu peux programmer ton PIC en debug avec le bootloader et débugger pour voir où ça plante (en utilisant le programme de Microchip pour flasher le PIC et faire du pas à pas dans le debug de MPLABX.

  27. #26
    davidif

    Re : bootloader pic32MX795F512L

    En faite, je n'est pas de message d'erreur, la led clignote bien après le chargement du bootloader, donc je pense que s'est bon signe de ce côté là, après je récupère mon hex puis le programme et là rien, il n'y a pas de manip particulière qui m'aurai échapper , il n'a pas besoin d'appuyer sur un swich notamment celui ou la led clignote (bon je les déjà fait à vrai dire , mais rien ne ce passe)

    j'ai fais du débug comme tu me la conseiller avec le bootloader, puis charger le fichier hex mais là pareil rien ne ce passe à la même étape, le debug ne stop pas du tout, il me semble bien renseigner les links :

    J'ai donc touché au fichier bootloader.h également :

    #define USER_APP_RESET_ADDRESS (0x9D006000 + 0x1000)

    Code:
    // Copyright (c) 2002-2010,  Microchip Technology Inc.
    //
    // Microchip licenses this software to you solely for use with Microchip
    // products.  The software is owned by Microchip and its licensors, and
    // is protected under applicable copyright laws.  All rights reserved.
    //
    // SOFTWARE IS PROVIDED "AS IS."  MICROCHIP EXPRESSLY DISCLAIMS ANY
    // WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING BUT
    // NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
    // FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.  IN NO EVENT SHALL
    // MICROCHIP BE LIABLE FOR ANY INCIDENTAL, SPECIAL, INDIRECT OR
    // CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, HARM TO YOUR
    // EQUIPMENT, COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY
    // OR SERVICES, ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED
    // TO ANY DEFENSE THEREOF), ANY CLAIMS FOR INDEMNITY OR CONTRIBUTION,
    // OR OTHER SIMILAR COSTS.
    //
    // To the fullest extent allowed by law, Microchip and its licensors
    // liability shall not exceed the amount of fees, if any, that you
    // have paid directly to Microchip to use this software.
    //
    // MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE
    // OF THESE TERMS.
    #ifndef __BOOTLOADER_H__
    #define __BOOTLOADER_H__
    
    //#define PROGRAM_FLASH_END_ADRESS (0x9D000000+BMXPFMSZ-1)
    #define PROGRAM_FLASH_END_ADRESS (0x9D006000 + 0x1000 + 0x970)
    
    
    
    //-------User configurable macros begin---------
    #define MAJOR_VERSION 1
    #define MINOR_VERSION 0
    
    
    /* APP_FLASH_BASE_ADDRESS and APP_FLASH_END_ADDRESS reserves program Flash for the application*/ 
    /* Rule: 
     		1)The memory regions kseg0_program_mem, kseg0_boot_mem, exception_mem and 
     		kseg1_boot_mem of the application linker script must fall with in APP_FLASH_BASE_ADDRESS 
     		and APP_FLASH_END_ADDRESS
     		 
     		2)The base address and end address must align on  4K address boundary */
     		
    //#define APP_FLASH_BASE_ADDRESS 	0x9D006000
    #define APP_FLASH_BASE_ADDRESS 	0x9D000000
    #define APP_FLASH_END_ADDRESS   PROGRAM_FLASH_END_ADRESS
    //#define APP_FLASH_END_ADDRESS   0x9D07FFFF
    
    /* Address of  the Flash from where the application starts executing */
    /* Rule: Set APP_FLASH_BASE_ADDRESS to _RESET_ADDR value of application linker script*/
    
    // For PIC32MX1xx and PIC32MX2xx Controllers only
    #define USER_APP_RESET_ADDRESS 	(0x9D006000 + 0x1000)
    //#define USER_APP_RESET_ADDRESS 	(0x9D000000 + 0x1000 + 0x970)
    
    
    
    //-------User configurable macros end-----------
    
    
    
    #if defined(TRANSPORT_LAYER_UART)
    	#include "Include\Uart\Uart.h"
    #elif defined(TRANSPORT_LAYER_USB)
    	#include "Include\Usb\Usb_Tasks.h"
    #elif defined(TRANSPORT_LAYER_ETH)
    	#include "Include\Ethernet\EthernetTasks.h"
    #elif defined(TRANSPORT_LAYER_SD_CARD)
    	// Add SD card bootloader specific header files
    #elif defined(TRANSPORT_LAYER_USB_HOST)
        // Add USB Host specific header files.
    #else
    	/* Note ****: User has to define TANSPORT_LAYER . 
    	To do this, in the MPLAB IDE navigate to menu Project->Build Options->Project.
    	Select "MPLAB PIC32 C Compiler" tab. Select categories as "General" from the dropdown list box.
    	Click Add button and define the TANSPORT_LAYER under "Preprocessor Macros".*/
    
    	#error ("TRANSPORT_LAYER is either not defined or not defined properly");
    #endif
    #endif
    Fichiers attachés Fichiers attachés

  28. #27
    davidif

    Re : bootloader pic32MX795F512L

    Bon apparemment je viens de me rendre compte que je prenais le fichier hex compilé sous mplad ide et pas celui, construit par mplabx, le temps de faire l'essai je te confirme ça

  29. #28
    gofio79

    Re : bootloader pic32MX795F512L

    Ton fichier bootloader.h n'est pas bon.
    Quelques petites choses à savoir :

    USER_APP_RESET_ADDRESS = à la valeur de _RESET_ADDR de ton fichier programme principale.ld (Adresse à laquelle le bootloader va lancer l'aaplication donc doit pointer sur l'adresse de début de ton programme principal).

    PROGRAM_FLASH_END_ADRESS = est l'adresse maximale à laquelle tu autorise le flashage de la flash. Donc tu autorise de flasher ton PIC jusqu'à la fin. (0x9D000000+BMXPFMSZ-1) 0x9D000000 = Début de la flash. BMXPFMSZ = taille de la flash de ce PIC. Donc laisse le comme il était.

    APP_FLASH_BASE_ADDRESS = Début de la zone de la flash à laquelle tu autorise de flasher le flash. Donc tu autorise de flash ta flash après la zone qui contient ton programme bootloader donc 0x9D006000. En général = _ebase_address du fichier linker de ton prog principal.

    APP_FLASH_END_ADDRESS = Fin de la zone de la flash à laquelle tu autorise de flasher. Dans notre cas, c'est égale à la taille max.


    Donc voilà c'est surement pour ça que ton programme ne se lance pas. Tu essaye de flasher ton programme principal sur ton bootloader et comme il y a une protection pour ne pas effacer ton bootloader, tu ne faisais rien.

  30. #29
    davidif

    Re : bootloader pic32MX795F512L

    c'est ok gofio79 !! ça fonctionne enfin
    par contre, il va falloire que je vois ou mettre mes valeurs de variable par ce qu'apparemment là ou j'écrit certaine variables dans la flash, au redémarrage j'ai d'autres valeurs différentes.

    Avant je mémorisais mes valeurs a partir de #define NVM_PROGRAM_PAGE 0xBD000000 , maintenant il faut que je me place kseg1_data_mem (w!x) : ORIGIN = 0xA0000000, LENGTH = 0x18000 ?

    Sinon Merci pour l'aide et tes explications claire qui m'ont éclairé dans le processus du bootloader

  31. #30
    davidif

    Re : bootloader pic32MX795F512L

    En fait, avant sans le bootloader je faisais comme ça pour sauvegarder mes valeurs dans la flash

    Code:
    void WriteFlash(unsigned int data,unsigned int address)
    {
    unsigned int addr=NVM_PROGRAM_PAGE + address;
    //int i=0;
    	
    	if(*(unsigned int *)(addr) != 0xFFFFFFFF)
    	{	
            NVMErasePage((void*) NVM_PROGRAM_PAGE);
    	NVMWriteWord((void*)(NVM_PROGRAM_PAGE + 0), out1_usb);
    	NVMWriteWord((void*)(NVM_PROGRAM_PAGE + 4), out2_usb);
    	NVMWriteWord((void*)(NVM_PROGRAM_PAGE + 8), out3_usb);
    	NVMWriteWord((void*)(NVM_PROGRAM_PAGE + 12), out4_usb);
    	NVMWriteWord((void*)(NVM_PROGRAM_PAGE + 16), out5_usb);	
    	}
    	else
    	{
    	NVMWriteWord((void*)(addr), data);
    	data=*(unsigned int *)(addr);
    	if(*(unsigned int *)(addr) != data)	LED3=1; else LED3=0;
    	}
    
    }
    Puis je lisais mes valeurs au redemarrage

    Code:
    out1_usb=*(int*)(NVM_PROGRAM_PAGE);
    //ReadFlash(NVM_PROGRAM_PAGE,out1_usb);
    if (out1_usb==0xFFFFFFFF) out1_usb=0;
    
    
    out2_usb=*(int*)(NVM_PROGRAM_PAGE+4);
    if (out2_usb==0xFFFFFFFF) out2_usb=0;
    
    out3_usb=*(int*)(NVM_PROGRAM_PAGE+8);
    if (out3_usb==0xFFFFFFFF) out3_usb=0;
    
    
    out4_usb=*(int*)(NVM_PROGRAM_PAGE+12);
    if (out4_usb==0xFFFFFFFF) out4_usb=0;
    
    out5_usb=*(int*)(NVM_PROGRAM_PAGE+16);
    if (out5_usb==0xFFFFFFFF) out5_usb=0;
    sachant que

    #define NVM_PROGRAM_PAGE 0xBD000000

    j'arrivais donc à mémoriser mes valeurs , et maintenant quand je redémarre je récupères d'autres valeurs complétement différentes de ce que j'avais mémorisé.

    Je suppose qu'il faut que je place NVM_PROGRAM_PAGE ailleur, mais ou ? Par rapport à l'espace qu'occupe le bootloader et le programme.

Page 1 sur 2 1 DernièreDernière

Discussions similaires

  1. bootloader
    Par bilet38 dans le forum Électronique
    Réponses: 4
    Dernier message: 13/04/2013, 08h23
  2. TCP/IP sur PIC32MX795F512L
    Par invite3bb6cfa9 dans le forum Électronique
    Réponses: 2
    Dernier message: 13/02/2012, 22h58
  3. BootLoader
    Par invitec1317d72 dans le forum Électronique
    Réponses: 2
    Dernier message: 25/04/2008, 09h02
  4. Le bootloader
    Par invite7cfe973c dans le forum Technologies
    Réponses: 0
    Dernier message: 31/12/2005, 11h09
  5. Bootloader
    Par invite367afa16 dans le forum Électronique
    Réponses: 0
    Dernier message: 11/02/2005, 14h36
Découvrez nos comparatifs produits sur l'informatique et les technologies.