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

T3W1 PCB bring-up #4350

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open

T3W1 PCB bring-up #4350

wants to merge 22 commits into from

Conversation

TychoVrahe
Copy link
Contributor

@TychoVrahe TychoVrahe commented Nov 14, 2024

This PR adds RGB LED driver for T3W1. Syscall is added to enable driving from app.

Old RGB LED driver is removed, as it is no longer needed after ditching old boards.

Power button configuration is added to rev A board.

There was an error in setting the U5 clock with 32MHz HSE, so i fixed it here too. Some unused clock-configuration stuff is removed from startup_init.

Another HSE implications are for systick calculation, which need proper value set in stm32u5xx_hal_conf.h, so i replaced the HSE_xxMHz with native HSE_VALUE=xxx and move it to global.

USB driver was adjusted to work with 32MHz HSE too.

SBU pins are configured for T3W1. I removed "sbu" from features wanted in firmware, kernel and unix, its only needed for prodtest.

Another MPU bugfix: kernel SRAM setting was off, as SRAM1 now contains framebuffe on U5G.

The mock display driver was modified a bit so it doesn't crash when someone tries some rendering - one framebuffer is allocated for that purpose.

@TychoVrahe TychoVrahe self-assigned this Nov 14, 2024
Copy link

github-actions bot commented Nov 14, 2024

legacy UI changes device test(screens) main(screens)

Copy link

github-actions bot commented Nov 14, 2024

core UI changes device test click test persistence test
T2T1 Model T test(screens) main(screens) test(screens) main(screens) test(screens) main(screens)
T3B1 Safe 3 test(screens) main(screens) test(screens) main(screens) test(screens) main(screens)
T3T1 Safe 5 test(screens) main(screens) test(screens) main(screens) test(screens) main(screens)
All main(screens)

@TychoVrahe TychoVrahe force-pushed the tychovrahe/T3W1/led branch 3 times, most recently from 6c5b0e5 to 58a77d7 Compare November 14, 2024 13:01
@TychoVrahe TychoVrahe marked this pull request as ready for review November 14, 2024 13:18
@TychoVrahe TychoVrahe marked this pull request as draft November 14, 2024 15:53
@TychoVrahe TychoVrahe changed the base branch from main to cepetr/drv-relocation November 15, 2024 11:16
@TychoVrahe TychoVrahe changed the title LED driver and power button for T3W1 T3W1 PCB bring-up Nov 15, 2024
@cepetr cepetr force-pushed the cepetr/drv-relocation branch 3 times, most recently from f4bba1f to 9e700bf Compare November 15, 2024 14:12
@TychoVrahe TychoVrahe marked this pull request as ready for review November 18, 2024 07:54
@TychoVrahe TychoVrahe requested review from cepetr and removed request for prusnak November 18, 2024 07:55
Base automatically changed from cepetr/drv-relocation to main November 18, 2024 08:41
@@ -369,7 +369,7 @@ int bootloader_main(void) {
#ifdef USE_TOUCH
secbool touch_initialized = secfalse;
secbool allow_touchless_mode = secfalse;
#ifdef TREZOR_MODEL_T3T1
#if defined TREZOR_MODEL_T3T1 || defined TREZOR_MODEL_T3W1
// on T3T1, tester needs to run without touch, so making an exception
Copy link
Member

Choose a reason for hiding this comment

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

maybe add T3W1 to the comment too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed c927e91

@@ -41,8 +41,7 @@ uint8_t physical_frame_buffer_1[PHYSICAL_FRAME_BUFFER_SIZE];

// The current frame buffer selector at fixed memory address
// It's shared between bootloaders and the firmware
__attribute__((section(".framebuffer_select"))) uint32_t current_frame_buffer =
0;
uint32_t current_frame_buffer = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the current_frame_buffer is no longer persistent, we can move it to the driver state structure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed 10e3635

drv->active_fb_addr = (uint32_t)addr;
drv->active_fb_size = size;

mpu_reconfig(drv->mode);
Copy link
Contributor

Choose a reason for hiding this comment

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

I would be better to add some synchronization here since drv->active_fb_xxx can be now potentially used in the interrupt context.

irq_key_t irq_key = irq_lock();
drv->active_fb_addr = ..;
drv->active_fb_size = ..;
irq_unlock(irq_key);

mpu_reconfig(drv->mode);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed 6b3babc

@@ -208,12 +210,15 @@ static void copy_fb_to_display(uint8_t index) {
uint16_t *fb = (uint16_t *)get_fb_ptr(index);

if (fb != NULL) {
mpu_set_active_fb(fb, PHYSICAL_FRAME_BUFFER_SIZE);
Copy link
Contributor

Choose a reason for hiding this comment

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

By adding this, the copy_fb_to_display function now has the side effect of disabling the frame buffer (for both privileged and unprivileged modes). This slightly impacts the display API behavior - after calling display_set_orientation, the acquired frame buffer is no longer accessible. I believe we don’t need to fix this, but it’s important to be aware of it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

as discussed in person, lets postpone fixing this until needed

@TychoVrahe
Copy link
Contributor Author

Added one more commit separating the bootargs from kernel/aux SRAM, adding separate MPU mode for handling it: 0be697c, @cepetr please review that as well

@TychoVrahe TychoVrahe requested review from prusnak and cepetr and removed request for prusnak November 19, 2024 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🏃‍♀️ In progress
Development

Successfully merging this pull request may close these issues.

3 participants