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

Repair this program for 2015. #11

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 23 additions & 11 deletions tools/usbboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ typedef struct tocentry {

#define USE_TOC 0

int match_omap4_bootloader(usb_ifc_info *ifc)
{
if (ifc->dev_vendor != 0x0451)
return -1;
if ((ifc->dev_product != 0xd010) && (ifc->dev_product != 0xd00f))
return -1;
return 0;
}

int usb_boot(usb_handle *usb,
void *data, unsigned sz,
void *data2, unsigned sz2)
Expand Down Expand Up @@ -81,14 +90,26 @@ int usb_boot(usb_handle *usb,
usb_write(usb, &msg_boot, sizeof(msg_boot));
usb_write(usb, &msg_size, sizeof(msg_size));
usb_write(usb, data, sz);



if (data2) {
fprintf(stderr,"waiting for 2ndstage response...\n");

// sleep lets the 2nd stage prepare itself.
// if speak to it too quickly it may or may not be ready, and if not it will cut you off.
sleep(5);

// look for the 2nd stage's "I'm here!" banner
usb_read(usb, &msg_size, sizeof(msg_size));
// msg_size is just a convenient piece of RAM available
// the value we read is not any sort of message size.
if (msg_size != 0xaabbccdd) {
fprintf(stderr,"unexpected 2ndstage response\n");
fprintf(stderr,"unexpected 2ndstage response 0x%08X\n", msg_size);
return -1;
}

// since the 2nd stage looks ready to accept the 3rd,
// send it over:
msg_size = sz2;
fprintf(stderr,"sending image to target...\n");
usb_write(usb, &msg_size, sizeof(msg_size));
Expand All @@ -98,15 +119,6 @@ int usb_boot(usb_handle *usb,
return 0;
}

int match_omap4_bootloader(usb_ifc_info *ifc)
{
if (ifc->dev_vendor != 0x0451)
return -1;
if ((ifc->dev_product != 0xd010) && (ifc->dev_product != 0xd00f))
return -1;
return 0;
}

void *load_file(const char *file, unsigned *sz)
{
void *data;
Expand Down
1 change: 1 addition & 0 deletions trusted.S
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ call_trusted:
dsb
isb
dmb
.arch_extension sec
smc 1
ldmfd sp!, {r4-r12,lr}
bx lr
Expand Down