-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
crt0.S: Do not clear XIP control registers except in bootloader mode #318
Conversation
Nice fix! 👍 😉 I think this is a general problem - not limited to the XIP module. If you configure any IO/peripheral device in the bootloader and then jump to another executable, all the modifications will be lost as the other executable will re-run the IO reset loop in Maybe it would be better to have a general "do or do not IO reset" switch for the start-up code. For example we could add something like this around the IO reset loop: #ifndef NO_IO_RESET
__crt0_reset_io_loop:
sw zero, 0(x8)
addi x8, x8, 4
bne x8, x9, __crt0_reset_io_loop
#endif Then we can switch off the reset loop while invoking the makfile by defining $ make USER_FLAGS+=-DNO_IO_RESET clean_all exe What do you think about this? 🤔 @GideonZ maybe this is also interesting for you ;) |
Works for me as well :-) Not sure whether we'd have to reset the UART in the bootloader then though... |
Do you might want to update this PR (or open a new one)? 😉
I am not sure what you mean here 😅 |
I was just thinking that the bootloader uses the UART, so it stays initialized after the user application is started. But I guess that should not really matter. As you say, it will be reinitialized anyway when the application uses it.
Sure. I'll have to delay this until tomorrow though. By the way: What should be the default? Reset enabled or not enabled? Or maybe default to enabled for the bootloader and default to disabled for applications? |
Thanks! 👍
I think the default should be the current situation, so resetting IO is always enabled - unless it is explicitly disabled by the user. |
3c9714c
to
105fd9f
Compare
I've updated the PR as discussed. I also tested this with the hello_world example and it's working as expected. Maybe it makes sense to include a note in the documentation that |
🚀
|
Define NO_IO_RESET to disable the peripheral reset in the early startup code. This is useful when running code from XIP flash, as we do not want to reset the XIP controller in that case. Note: Make sure to run "make clean_all" if you changed this flag. Usage: make USER_FLAGS+=-DNO_IO_RESET exe
Compile-time switch to turn off the default "software reset" of all IO/peripheral devices executed by the crt0 start-up code.
It kinda is, it was the first thing I've tried when make clean didn't work :-) |
When the bootloader executes an application from XIP, the startup code should not disable the XIP unit, otherwise the application will crash.