This is my first post in this forum so please excuse me if this should be in the "Software" area. (couldn't really decide)
Anyway I just got my R4 WiFi and really wanted to dive into the guts of it.
I love the eclipse IDE so looks like e2 Studio was the way to go.
I found an example online about creating a "Bare Metal Blinky Project" and
seems like my code should work but of course it doesn't.
I'm not asking for help there yet, I''l keep trying to get that LED blinking. I think it could be the configuration of the clocks or GPIO not happening as expected.
The other interesting thing I encountered is uploading the code.
I discovered using bossac.exe do the job (almost)
I can use the command "bossac -a --port=COM15
" to get the board into upload mode with the 1200 baud trick.
Then "bossac -d --port=COM15 -U -e -w test02.bin -R
" will upload my code but ONLY after I have used the Arduino IDE to upload "something" first.
After that initial upload bossac commands work fine UNTIL I power the board off. (weird huh)
Then I'll get "No Device found on COM15" error.
I can tell the first command gets the board into upload mode because the LED is fading in & out but the second command fails after a power cycle.
So I'm really interested in hearing from others who may have tried e2 Studio and uploading code from the command line.
Thanks
Eric
Update: 12/31/2023
The problem uploading the code can be resolved by using the arduino-cli tool instead of issuing the bossac commands. unfortunately this would require installing the entire Arduino IDE, the R4 board support and the arduino-cli tool.
I also tried compiling my 4 lines of e2 Studio/bsl code using the arduino IDE and it blinks the LED nicely. So still investigating why I can't get this simple program to run using e2 Studio.
Update 1/7/2024 Happy New Year
After a great deal of experimentation I have finally got something working.
I found some of the FSP related files that the Arduino IDE installs to support the R4 board.
Tried using the linker scripts fsp.ld and memory_regions.ld that Arduino IDE uses (which generated tons of error & warning messages) like a missing library libfsp.a and other incorrect values.
Eventually with LOTs of tweaks and modifications I'm now able to compile and execute code on the R4 using e2 studio.
I'm sorry to admit that my knowledge of linker scripts is minimal but I'm guessing the Arduino people have loaded a bootloader on the microcontroller so the executable code needs to be loaded to a different address.
There's also some properties in the configuration.xml file that needed to be adjusted manually as I couldn't find a way in the e2 Studio configuration IDE that set them.
The good news in now I can simply copy my "Blinky" project with all the adjustments, and use that copy as a starting point for further development.
Update 1/9/2024
After a couple more days of messing around I reduced the project modifications to adding a single
line to a linker script file named memory_regions.ld
"FLASH_IMAGE_START = 0x4000;"
Of course that file gets re-built with each build so a couple more mods were necessary.
So I now have my LED blinking and have a very basic UART running, but no interrupts will fire. On to trying to figure out why interrupts will not work.
Update 1/12/2024
I'm very excited to have found a solution !!! (it came to me while lying in bed awake at 3:30am ).
A call the arm function __enable_irq(); did the trick!! (yay!!!)
I'm assuming the Arduino bootloader passes control over to the user's program with interrupts disabled.
Update 2/5/2024
Read all about my experience with this here:
https://sites.google.com/site/ericmklaus/projects-1/arduino-r4-wifi
Instructions and sample projects included.