0

Metro M4 Grand Central board
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: Metro M4 Grand Central board

by User_UMjT7KxnxP8YN8 on Wed Oct 07, 2020 1:04 am

But I didn't answer your question about how you change the load address when you're building. If you're using the Arduino IDE you can change the address at which your application starts in C:\Users\[your_username]\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.5.14\boards.txt

Find the line that says

adafruit_grandcentral_m4.upload.offset=0x4000

and change it to

adafruit_grandcentral_m4.upload.offset=0x0000

If I recall correctly, In AS7 you go to Project->Properties->ToolChain->ARM/GNU Linker->Memory Settings and set the FLASH Segment to 0x00000000, but you should verify this.

When loading a program in AS7 you do it the same way you reinstalled the bootloader. You'll see an option to set the address.

User_UMjT7KxnxP8YN8
 
Posts: 236
Joined: Tue Jul 17, 2018 1:28 pm

Re: Metro M4 Grand Central board

by akki0075 on Wed Oct 07, 2020 12:25 pm

Your question is right why do I want to eliminate the bootloader.

The thing is that soon we are going yo get 100s of custom PCBs having the same MCU in it with JTAG connector. I saw in the datasheet that the device package which we have selected, comes with pre-loaded factory bootloader (which is a UART as mentioned by Microchip support team). So in case if it comes with that bootloader or w/o any bootloader, my question to you is that in either of the case, I can take out the bootloader (being used in this Grand central board) from the https://github.com/adafruit/uf2-samdx1/ ... ag/v3.10.0 and flash it to our custom PCB's MCU and upload the application using Ozone (with .elf file) via J-link programing?

-Akshay

akki0075
 
Posts: 49
Joined: Fri Jan 17, 2020 6:51 pm

Re: Metro M4 Grand Central board

by User_UMjT7KxnxP8YN8 on Wed Oct 07, 2020 1:31 pm

Absolutely. I've created a custom bootloader to support secure network updates and I can upload my application using the Arduino IDE or Ozone. Presumably I could do it with AS7 too but Visual Studio (upon which it is built) is a dog.

You can also use J-Flash, which is probably a better tool for production.

My plan is during production to install my bootloader and a minimal application capable only of running a hardware selftest and updating the firmware. The real application will be installed the first time the system boots with network access.

User_UMjT7KxnxP8YN8
 
Posts: 236
Joined: Tue Jul 17, 2018 1:28 pm

Re: Metro M4 Grand Central board

by akki0075 on Wed Oct 07, 2020 4:07 pm

So you are saying I can easily flash bootloader (present in grand central) in our custom PCBs? I won't get any compatibility issues? If YES, then I can plan to proceed with flashing the same bootloader into our custom PCB's MCU using AS7 via SEGGER J-link and upload the application (.elf file built by Arduino IDE) using Ozone via j-link programming.

Also, my employer might go for ATSAMD51J19A later in the future due to supply chain issues. Feather M4 express has the same MCU. That time I can use the same bootloader (being used in feather m4 express) into our custom PCBs right? Steps would remain the same right as long as the MCU is same.

Last question: Can I customize the bootloader (.bin file) depending upon which MCU we choose? What changes are basically required in the bootloader if we choose some different MCU? Are the changes difficult to make?

Thanks,
Akshay

akki0075
 
Posts: 49
Joined: Fri Jan 17, 2020 6:51 pm

Re: Metro M4 Grand Central board

by User_UMjT7KxnxP8YN8 on Thu Oct 08, 2020 1:05 am

I don't know enough about your custom boards to answer your question, but the Adafruit bootloaders for the Metro M4 contains conditional compilation directives that let it support both SAMD51 and SAMD21 chips. At first glance, the Grand Central's ATSAMD51P20 seems to be an ATSAMD51J19A with more memory.

Just looked at Adafruit's bootloaders - C:\Users\[your_username]\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.5.14\bootloaders

I see one version for "metroM4", and no separate version for the Grand Central so I suspect they're identical.

If your custom board uses a UART in the ATSAMD51P20 like the Grand Central does, I suspect you'll be fine.

Note, however, that you may want to disable the SAMBA feature that permits USB uploads to your board to prevent your product firmware from being replaced with unauthorized code. As I noted earlier, I plan to do that when application development is completed, but it's a nice feature in the meantime. I believe you just change a #define statement to remove it.

User_UMjT7KxnxP8YN8
 
Posts: 236
Joined: Tue Jul 17, 2018 1:28 pm

Re: Metro M4 Grand Central board

by akki0075 on Thu Oct 08, 2020 1:38 am

Can you share the location where i can disable the SAMBA feature?

One thing struck to my mind today was that even though our custom board and grand central board has the same MCU but our custom board has few additional pin assignments and few pin assignments have been changed. I have been looking into the variants folder. Do I have to create a custom variant like make some changes to variant.cpp and variant.h files?
Eventually I will have to add our custom board to Arduino IDE by creating a new .json file?

I wonder that if I use the same variant as grand central as well as the UF2 bootloader as for our custom board and we declare the same additional MCU pins to something in the firmware, but compiler could show error due to pins undeclaration. The cause of this compilation error could be that those pins are not defined in the board's variant files? Am I saying right?

akki0075
 
Posts: 49
Joined: Fri Jan 17, 2020 6:51 pm

Please be positive and constructive with your questions and comments.