I’m new using BBB, and I would like to know some tips about how to compile C programs for baremetal BBB.
I’m currently loading the programs manually with uboot via serial port, my cross-compiler toolchain is arm-none-eabi.
For what I understand, U-boot already initialize the hardware part, so that should not be a concern. My main goal is to count the clock cycles from begining to end of .bin execution, so my questions are:
1 - is there a way to get this info from u-boot directly, or do i need to instrument my code and transfer it through serial port?
2 - After .bin execution u-boot restarts the board, can i prevent it and just come back to the terminal?
3 - Inside uboot folder we have some function declarations as printf, for example. I imagine that uboot already define it targeting the serial port, can I reuse it? Uboot has a hello_world example utilizing it, but it should be compiled during uboot built, which it wasn’t so i think my board isn’t compatible with this example or I did something wrong?
That is a big project.
What is working for us is yocto image and only build it with what we need. Unless you have a significant need to have bare metal the headless BBB image is very good and practical solution. Its not the BBB, its the SoC that is way too complex for a practical solution, yes you can do it however you better have a room full of developers and pocket full of money.
I’m trying to measure worst cases for .c programs, so I would like to remove OS overhead, the best scenario for me would be if I was able to execute the program on a bare-metal environment.
I just don’t get why it seems to be so hard print through serial using uboot. Does anyone have any solution to run baremetal on beaglebone black and print something through serial??
Use yocto and build core-image-minimal. That is about a bare as you are going to get, that is the kernel and some networking.
First of all, thanks for the suggestion!
I’m sorry for the delay on the answer, I was trying to figure out a way out. So, what worked for me was to access the clock register from cortex-a8 via assembly, and then save the data on an array in the memory. So, to retrieve the stored data I just display the memory with “md” command from u-boot. this removed my need of some kind of printf implementation.