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 6 times, most recently from e7cc4b8 to 4481dbf Compare February 5, 2025 11:16
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/...)

@NickeZ NickeZ force-pushed the nickez/bootloader-rtt branch 3 times, most recently from 46bf7be to 4bd813d Compare February 19, 2025 09:45
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.
@NickeZ NickeZ force-pushed the nickez/bootloader-rtt branch from 4bd813d to 3e4f0b4 Compare February 19, 2025 10:29
@NickeZ
Copy link
Collaborator Author

NickeZ commented Feb 19, 2025

Rebased and fixed the reason it was affecting the release bootloader.

@NickeZ NickeZ requested a review from benma February 19, 2025 10:41
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