Closed gioreva closed 6 years ago
Yes.
Sent from my mobile
Le 12 août 2018 à 06:18, gioreva notifications@github.com a écrit :
/ Enable the input mode in Boot GPIO Pin PB02 @ group1 / PORT->Group[0].DIRCLR.reg = (1U << PINPA04); PORT->Group[0].PINCFG[PINPB02].reg = PORT_PINCFG_INEN | PORT_PINCFG_PULLEN; PORT->Group[0].OUTSET.reg = (1U << PIN_PA04); / Read the BOOT_LOAD_PIN PA04 status / boot_en = (PORT->Group[0].IN.reg) & (1U << PIN_PA04); — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
Why do you recommend putting 7 BOOTPROT and disable protection ? Is not it better to enable BOOTPROT protection ? If you accidentally delete the bootloader, the card must be sent back to the manufacturer.
Ok, need put bootprog to 7 Upload bootloader then put bootprog to 2
But how to compile your sources ? I have many problem of error.
The bootloader only start writing after address 0x8000 (32kB).
Not the same as the UF2 bootloader that lets you write at the addresses contained in the .uf2 file.
Feel free to block the bootloader zone after you programmed it.
Sent from my mobile
Le 13 août 2018 à 11:28, gioreva notifications@github.com a écrit :
Ok, need put bootprog to 7 Upload bootloader then put bootprog to 2
But how to compile your sources ? I have many problem of error.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
The SDbootloader uses 32kB of memory, mainly because of the FAT library... so the bootprot will need to be set to 0x00 for full protection
http://ww1.microchip.com/downloads/en/DeviceDoc/SAM-D21-Family-Datasheet-DS40001882C.pdf#page=387
Not close. I can not find a way to compile your sources. I have no problems with the original ATMEL SDboot, but those ATMEL I can not compile them out for SAMD21, when I Change CPU, dependency are not compatible.
Four Your, I make new "GCC C ASF Board Project", on Atmel Studio. Then I copy your tree on the folder. I remove main.c from project, and i add "spi_master_bootloader.c"
When i buil, compiler says:
Severity Code Description Project File Line Error delay.h: No such file or directory SD2 C:\Users\x-gio\Documents\Project\Geva\GEVINO opto\Arduino\SAMD21-SDBootloader-master\SD2\SD2\src\asf.h 60 Error recipe for target 'src/spi_master_bootloader.o' failed SD2 C:\Users\x-gio\Documents\Project\Geva\GEVINO opto\Arduino\SAMD21-SDBootloader-master\SD2\SD2\Debug\Makefile 172 Error recipe for target 'src/ASF/common2/boards/user_board/init.o' failed SD2 C:\Users\x-gio\Documents\Project\Geva\GEVINO opto\Arduino\SAMD21-SDBootloader-master\SD2\SD2\Debug\Makefile 179 Error delay.h: No such file or directory SD2 C:\Users\x-gio\Documents\Project\Geva\GEVINO opto\Arduino\SAMD21-SDBootloader-master\SD2\SD2\src\asf.h 60
bootprot = 0 is for 32K for protect 8K is 2 Same of arduino original bootloader.
Other attempts and other errors. Can you also publish the atmel studio project or the way to compile?
Severity Code Description Project File Line Error compiler.h: No such file or directory SD-Boot C:\Users\x-gio\Documents\Project\Geva\GEVINO opto\Arduino\boot\SAMD21-SDBootloader-master\SD-Boot\SD-Boot\asf.h 56 Error recipe for target 'spi_master_bootloader.o' failed SD-Boot C:\Users\x-gio\Documents\Project\Geva\GEVINO opto\Arduino\boot\SAMD21-SDBootloader-master\SD-Boot\SD-Boot\Debug\Makefile 76
I just added the project file. to add all the librairies, this could take some time as this project is running a another computer not well setup for proper git and file compare.
you'll need the ASF with fatfs. Since that time, I migrated to the D51 and have not yet been back on the bootloader ( but will before the end of the year )
I'll check to see what else i can do in the short run
Try it out ... just added ASF & fatfs
Everything works. Really thank you so much. Now I can try to convert it for my card. https://shop.gevaelettronica.it/en/home/30-arduino-plc-gevino-opto.html
Very nice product you have there.
Sent from my mobile
Le 17 août 2018 à 04:36, gioreva notifications@github.com a écrit :
Everything works. Really thank you so much. Now I can try to convert it for my card. https://shop.gevaelettronica.it/en/home/30-arduino-plc-gevino-opto.html
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.
Don”t forget that your apps need to be compiled with the same start address as the bootloader 0x8000.
Sent from my mobile
Le 17 août 2018 à 04:36, gioreva notifications@github.com a écrit :
Everything works. Really thank you so much. Now I can try to convert it for my card. https://shop.gevaelettronica.it/en/home/30-arduino-plc-gevino-opto.html
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.
Arduino compile so ? It seems me the same address of arduino bootloader.
Arduino bootloader uses 8kB and uses 0x2000 as start address.
This bootloader uses way more flash because of the required FAT library. So the app start address is 0x8000.
If you don”t compile you app to program with 0x8000 in the linker file. It won’t run.
Question regarding your product: since you have Sd card, why don’t you use the UF2 bootloader ?
Sent from my mobile
Le 18 août 2018 à 13:50, gioreva notifications@github.com a écrit :
Arduino compile so ? It seems me the same address of arduino bootloader.
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.
Way address 2000 is 8k and not 2k ? Because it is 32 bit CPU ?
USB MSC It does not seem very interesting for industrial use. much more interesting to use an sd.
I can not find it anymore, but I had read about a bootloader, which used to offset, before launching the app compiled by 0. Is it possible?
This, original atmel ad
/ Rebase the Stack Pointer / __set_MSP((uint32_t ) APP_START_ADDRESS);
/* Rebase the vector table base address */
SCB->VTOR = ((uint32_t) APP_START_ADDRESS & SCB_VTOR_TBLOFF_Msk);
/* Load the Reset Handler address of the application */
application_code_entry = (void (*)(void))(unsigned *)(*(unsigned *)
(APP_START_ADDRESS + 4));
/* Jump to user Reset Handler in the application */
application_code_entry();
Rebasing the vector table only affect the vectors called by the CPU hardware. The app you are "burning in" with the bootloader can only run at the address it has been "linked" for after compiling. Most arduino bootloaders are very small in size including the UF2 and therefore can keep operating within the original 8kB (0x2000) bootloader.
The SAMD51/E5x does offer dual-bank programming... in this case, your App would need to include the "Write-to-Flash" (bootloader) code. Run from first half of memory and program the new firmware in the second half. Once you are done, tell the CPU to run from the second bank.
Again, you'd need to make sure your App would start from address = 0x0000.
back to the SD-bootloder stuff: the linker address is 0x0000. your app linker start address 0x8000 [ ( normal arduino is set to 0x2000, see line 28] https://github.com/arduino/ArduinoCore-samd/blob/master/variants/arduino_zero/linker_scripts/gcc/flash_with_bootloader.ld
Ok, bootloader work, app work. But only first time if I leave bootprot to 7 If I change bootptog to 2 or zero, bootloader do not work. And second time, app work, but the app doesn't upgrade.
Solved problem, I ave initialized bad the CS. It occupies 5K, there would be space for Arduino Sam-ba. But I'm not able to do it.
Is there a light version of fat, only for read ?