On the simulator, the bootloader is automatically invoked by the 'oct-sim' script
To change the arguments provided to the bootoct command during simulator, an alternate u-boot environment file that specifies an alternate default boot command needs to be created. Multiple commands can be specified, with a semicolon (;) used as a separator. To change the stack and heap sizes, an environment file with the following content should be created:
oct-sim option '-envfile=env_file_name"
Outline of simple executive application startup:
- bootoct reads an Octeon executive application ELF file the specified address (defaults to 0x100000). The ELF file is parsed, and loaded into memory, including copying the data segments for all cores that will run this application. Memory for each core's stack and heap is also allocated.
- bootoct also creates a table in memory with an entry for each core that describes the application specific initialization that it needs to perform. This includes the TLB mappings required, application entry point, stack address/size, heap address/size.
- when core 0 is ready to start the other cores, it takes them out of reset, at which point they start execution from flash at the reset exception vector. Based on their non-zero core number, after performing the necessary per-core initialization, they jump to dram and process the table set up by core 0. When core 0 takes the other cores out of reset it also processes its own table entry. Core 0 also resets its cycle counter when it takes the other cores out of reset so that its cycle counter will be similar to the other cores' cycle counters.
- when the processing of the table is complete, each core sets some register state for the application, and does an ERET (return from exception) to the application entry point. The address of the table entry for the core is included in one of the registers.
- the stack, heap, and argc/argv are set for the application by init code called from crt0
- if the application is linked against the libcvmx.a library, the __cvmx_app_init() routine is called to initialize the simple exec. All cores are synchronized at this time so they will start main() at the same time.
- all cores enter main() at close to the same time.