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

pc-hosted semihosting #665

Merged
merged 1 commit into from
May 27, 2020
Merged

pc-hosted semihosting #665

merged 1 commit into from
May 27, 2020

Conversation

koendv
Copy link
Contributor

@koendv koendv commented May 17, 2020

As requested, semihosting for "blackmagic_hosted".
PC-hosted semihosting does keyboard, file and screen i/o on the system where blackmagic_hosted runs, using linux system calls, while semihosting in the probe does keyboard, file and screen i/o on the system where gdb runs, using gdb file i/o calls.

The pc-hosted semihosting was tested with the sketches from the Arduino STM32duino-semihosting library. Output attached.

semihosting_testbench.txt

ret = rename(fnam1, fnam2);
free(fnam1);
free(fnam2);
break;

Choose a reason for hiding this comment

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

All of these error handling conditions after successful malloc's fail to free the buffers before breaking. It looks like this is also an issue in some of the other commands

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right.

if (target_check_error(t)) break;
ret = write(params[0] - 1, buf, buf_len);
free(buf);
//fflush(stdout);

Choose a reason for hiding this comment

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

delete

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you wish to delete?

@TDHolmes
Copy link

TDHolmes commented May 24, 2020 via email

@koendv
Copy link
Contributor Author

koendv commented May 25, 2020

fixed, check again.

@TDHolmes
Copy link

malloc/free fix looks good! Can't really review the rest with much authority though, as I'm pretty new to all of this code.

@koendv
Copy link
Contributor Author

koendv commented May 26, 2020 via email

@UweBonnes
Copy link
Contributor

As stated on discord, please state explicit when you want me to merge.

@koendv
Copy link
Contributor Author

koendv commented May 26, 2020 via email

@UweBonnes
Copy link
Contributor

It is a good idea to rebase to master and run git log --check and git rebase --whitespace=fix master if problems show up.

@koendv
Copy link
Contributor Author

koendv commented May 27, 2020

ok. done.

@UweBonnes UweBonnes merged commit 6eb1b09 into blackmagic-debug:master May 27, 2020
@UweBonnes
Copy link
Contributor

Can you please check that my multi branch has rebase your changes in the right way?

@koendv
Copy link
Contributor Author

koendv commented May 27, 2020

Source looks good. On Raspberry Raspbian "Buster":
git clone --branch multi https://github.com/UweBonnes/blackmagic
make PROBE_HOST=hosted
LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libasan.so.5 ./src/blackmagic

Recognizes jlink, cmsis-dap, bmp.

@koendv koendv mentioned this pull request Apr 5, 2023
6 tasks
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.

3 participants