Skip to content
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

Debug: Adds RTT support to bootloader #1362

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

NickeZ
Copy link
Collaborator

@NickeZ NickeZ commented Feb 4, 2025

To support "handover" from bootloader to application, the RTT allocations are put in the same places in RAM in both projects. Without this the J-Link software will only find one of the allocations and therefore not read the other.

This does not have any impact on non-debug builds.

@NickeZ NickeZ requested a review from benma February 4, 2025 13:13
@NickeZ NickeZ force-pushed the nickez/bootloader-rtt branch 5 times, most recently from 2150503 to e7cc4b8 Compare February 4, 2025 15:33
To support "handover" from bootloader to application, the RTT
allocations are put in the same places in RAM in both projects. Without
this the J-Link software will only find one of the allocations and
therefore not read the other.
Copy link
Collaborator

@benma benma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The production bootloader.bin hash changes with this PR. I haven't investigated the difference yet. The size of it also increases by 176 bytes.

If it's only a debug build change I'd expect no change in the prod bootloader.

@@ -206,6 +207,8 @@ void _binExec(void* l_code_addr)

static void _binary_exec(void)
{
util_log("Jumping to firmware");
rust_rtt_flush();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we maybe call this in util_log() by default?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flush will wait until the debugger reads out the buffer and updates the read pointer. It isn't necessary in general, but if we don't do it here messages from the bootloader might be overwritten by the firmware.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

calling it every time will basically make RTT sync, when its speed/efficiency comes from it being async.

#if defined(BOOTLOADER)
#define PREFIX "boot"
#else
#define PREFIX "app"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fw or firmware? to disambiguate from our other use of app (bitcoin/ethereum/u2f/...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants