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

Fix #1349 #1447, Break up pc-rtems to support generic configuration and add tarfs support #1350

Merged
merged 1 commit into from
Apr 1, 2024

Conversation

skliper
Copy link
Contributor

@skliper skliper commented Jan 4, 2023

Checklist (Please check before submitting)

Describe the contribution

Splits up bsp_start.c so features can be optionally included: cmdline, shell, stand alone exe vs module
RTEMS configuration is now in bsp_init.c, included based on stand alone/module selection

Testing performed
Ran w/ LEON3 QEMU with/without shell and stand alone/module options.

Expected behavior changes
PC behavior shouldn't change based on default options matching previous behavior
Except for the file system and command line, the rest is usable by LEON3

System(s) tested on
LEON3 QEMU modified as documented by RCC:

apt-get update && apt-get install -y ninja-build pkg-config libglib2.0-dev python3 python3-pip python3-setuptools python3-wheel libpixman-1-dev && pip3 install meson
tar xvJf qemu-7.1.0.tar.xz
cd qemu-7.1.0
./configure --target-list=sparc-softmmu --enable-debug
make install

RCC-1.3.1
For running as a module I based it on https://github.com/alanc98/rki2, although there are mods...

Additional context
See notes in comments below for latest information

Third party code
None

Contributor Info - All information REQUIRED for consideration of pull request
Jacob Hageman - NASA/GSFC

@skliper
Copy link
Contributor Author

skliper commented Jan 4, 2023

@dmknutsen, @alanc98, @jphickey - maybe a splinter discussion/demonstration at some point? This implementation works for me and if this is accepted as a path forward I could finish it up, submit the toolchain I'm using to cFE and whatever is needed in the PSP (note I'm using the current RTEMS.cmake). Wouldn't be hard to add the QEMU LEON3 build/testing to CI.

Note it does still fail 4 tests in stand alone exe mode since I'm not setting up the nonvol file system yet and QEMU LEON3 doesn't have an eth device emulated. Other option could be to set up an internal run on one of the dev boards.

Note this doesn't setup drivers to run on the dev board yet, but that shouldn't be much extra work since rki2 has it implemented.

@skliper skliper requested a review from pepepr08 January 4, 2023 20:03
@skliper
Copy link
Contributor Author

skliper commented Jan 4, 2023

Note the applicable commit is 1503d51, the rest are just dependencies that make this easier and have their own PRs.

@pepepr08
Copy link
Contributor

pepepr08 commented Feb 3, 2023

I tested this and it works. With and without the shell. I was able to run some of the unit tests as well.

When running the cFS, it doesn't find the es startup script. We will need to fix this. Will probably get fixed when nonvol fs is set up.

@skliper
Copy link
Contributor Author

skliper commented Aug 3, 2023

Note - discussed at 20230803 CCB, sounds like this is the right direction just need to separate so the PC specifics can be included in that case (source select). Would be good to also set up a workflow to test on leon3 w/ QEMU. Even better if we had nonvol set up!

@skliper skliper force-pushed the fix1349-config_rtems branch 3 times, most recently from 9dcc4e5 to 2d2eb50 Compare February 23, 2024 23:38
@skliper skliper added the CCB:Ready Pull request is ready for discussion at the Configuration Control Board (CCB) label Feb 23, 2024
@skliper
Copy link
Contributor Author

skliper commented Feb 23, 2024

Passed cFS level checks (including rtems 4.11 and 5). See https://github.com/nasa/cFS/pull/746/checks

@pepepr08 Could you review?

@skliper skliper changed the title Fix #1349, Break up pc-rtems to support generic configuration Fix #1349 #1447, Break up pc-rtems to support generic configuration and add tarfs support Feb 24, 2024
@skliper
Copy link
Contributor Author

skliper commented Feb 26, 2024

Note this just supports tarfs from OSAL and doesn't actually add the two step build. Additional changes in work are needed in the PSP, see nasa/PSP#376. As a quick proof of concept I added the two step build from the prep step of an additional target, so user can build and install the main target, then create the tarfile and link/build as a separate follow on command (using the target config settings). Example:

# Create executable with built in tarfs

# In theory could just set up an executable with the extra steps to create the tarred object
# Setting up to easily run from prep, might work from install but would need to sort out directories

set(TARFS_DEV_DIR ${MISSION_BINARY_DIR}${CMAKE_INSTALL_PREFIX}/tarfs_dev)
set(DEV_DIR ${MISSION_BINARY_DIR}${CMAKE_INSTALL_PREFIX}/devboard)

file(MAKE_DIRECTORY ${TARFS_DEV_DIR})

# Create the nonvol tar file
execute_process(
  COMMAND tar cf ${TARFS_DEV_DIR}/tarfile nonvol
  WORKING_DIRECTORY ${DEV_DIR})

# Create the tar file object
execute_process(
  COMMAND ${CMAKE_LINKER} -r --noinhibit-exe -o tarfile.o -b binary tarfile
  WORKING_DIRECTORY ${TARFS_DEV_DIR})

# Convert since execute command needs list not string with spaces
string(REPLACE " " ";" TARFS_FLAGS_LIST ${RTEMS_SYS_SPECS_FLAGS} " " ${RTEMS_BSP_C_FLAGS})

file(GLOB devboard_exe "${MISSION_BINARY_DIR}${CMAKE_INSTALL_PREFIX}/devboard/*.exe")
foreach(executable ${devboard_exe})
  message("Processing executable: ${executable}")
  get_filename_component(BASE_NAME ${executable} NAME_WE)

  set(TARFS_LINK ${CMAKE_C_COMPILER} ${TARFS_FLAGS_LIST} ${executable} tarfile.o -lrtemscpu)

  message("")
  message("Prelink execution:")
  execute_process(
    COMMAND ${TARFS_LINK} -o ${BASE_NAME}.prelink
    WORKING_DIRECTORY ${TARFS_DEV_DIR}
    COMMAND_ECHO STDOUT
    OUTPUT_VARIABLE TARFS_PRELINK_OUT
    ERROR_VARIABLE TARFS_PRELINK_ERR)
  message("Output:\n${TARFS_PRELINK_OUT}Error:\n${TARFS_PRELINK_ERR}")

  message("Get dl symbols")
  execute_process(
    COMMAND ${RTEMS_TOOLS_PREFIX}/bin/rtems-syms -v -e -c ${RTEMS_BSP_C_FLAGS} -C ${CMAKE_C_COMPILER} -o ${BASE_NAME}-dl-sym.o ${BASE_NAME}.prelink
    WORKING_DIRECTORY ${TARFS_DEV_DIR}
    COMMAND_ECHO STDOUT
    OUTPUT_VARIABLE TARFS_PRELINK_OUT
    ERROR_VARIABLE TARFS_PRELINK_ERR)
  message("Output:\n${TARFS_PRELINK_OUT}Error:\n${TARFS_PRELINK_ERR}")

  message("Final link:")
  execute_process(
    COMMAND ${TARFS_LINK} ${BASE_NAME}-dl-sym.o -o ${BASE_NAME}.elf
    WORKING_DIRECTORY ${TARFS_DEV_DIR}
    COMMAND_ECHO STDOUT
    OUTPUT_VARIABLE TARFS_PRELINK_OUT
    ERROR_VARIABLE TARFS_PRELINK_ERR)
  message("Output:\n${TARFS_PRELINK_OUT}Error:\n${TARFS_PRELINK_ERR}")

  message("Strip binary:")
  execute_process(
    COMMAND ${CMAKE_OBJCOPY} -O binary --strip-all ${BASE_NAME}.elf ${BASE_NAME}.bin
    WORKING_DIRECTORY ${TARFS_DEV_DIR}
    COMMAND_ECHO STDOUT
    OUTPUT_VARIABLE TARFS_PRELINK_OUT
    ERROR_VARIABLE TARFS_PRELINK_ERR)
  message("Output:\n${TARFS_PRELINK_OUT}Error:\n${TARFS_PRELINK_ERR}")

  message("Strip elf:")
  execute_process(
    COMMAND ${CMAKE_OBJCOPY} --strip-all ${BASE_NAME}.elf ${BASE_NAME}-strip.elf
    WORKING_DIRECTORY ${TARFS_DEV_DIR}
    COMMAND_ECHO STDOUT
    OUTPUT_VARIABLE TARFS_PRELINK_OUT
    ERROR_VARIABLE TARFS_PRELINK_ERR)
  message("Output:\n${TARFS_PRELINK_OUT}Error:\n${TARFS_PRELINK_ERR}")

  message("Report sizes:")
  execute_process(
    COMMAND ${CMAKE_SIZE} ${BASE_NAME}.elf
    WORKING_DIRECTORY ${TARFS_DEV_DIR}
    COMMAND_ECHO STDOUT
    OUTPUT_VARIABLE TARFS_PRELINK_OUT
    ERROR_VARIABLE TARFS_PRELINK_ERR)
  message("Output:\n${TARFS_PRELINK_OUT}Error:\n${TARFS_PRELINK_ERR}")

endforeach()

@skliper skliper marked this pull request as ready for review February 29, 2024 18:49
@dzbaker
Copy link
Collaborator

dzbaker commented Feb 29, 2024

CCB 29 Feb 2024: @jphickey will perform review and CCB will revisit next week.

@pepepr08
Copy link
Contributor

@skliper Can we rename to generic-rtems?

@pepepr08
Copy link
Contributor

@skliper Can we rename to generic-rtems?

Maybe better to rename it in a separate merge since the renaming might break projects that are using pc-rtems

@pepepr08
Copy link
Contributor

@skliper Can we rename to generic-rtems?

Maybe better to rename it in a separate merge since the renaming might break projects that are using pc-rtems

Renaming also requires updates to the sample_defs, so we would need to update the cfe repo as well. I submitted PRs with the name change to @skliper 's branches, so we can easily merge it if we want to include it.

skliper#1
skliper/PSP#1

cFE PR for name change not created yet, but here is the commit: pepepr08/cFE@60286f3

@pepepr08
Copy link
Contributor

pepepr08 commented Mar 1, 2024

@skliper Can we rename to generic-rtems?

Maybe better to rename it in a separate merge since the renaming might break projects that are using pc-rtems

Renaming also requires updates to the sample_defs, so we would need to update the cfe repo as well. I submitted PRs with the name change to @skliper 's branches, so we can easily merge it if we want to include it.

skliper#1 skliper/PSP#1

cFE PR for name change not created yet, but here is the commit: pepepr08/cFE@60286f3

All checks passing for all changes on this PR + my renamed generic-rtems osal: https://github.com/nasa/cFS/pull/749/checks

@skliper
Copy link
Contributor Author

skliper commented Mar 21, 2024

@dzbaker @jphickey - Rebased and added as separate bsp. I'll add issues/PR's for the workflow changes separately.

@skliper
Copy link
Contributor Author

skliper commented Mar 21, 2024

Note this works w/ current workflows for rtems 5 and 4.11 (with the corresponding cFE update):
https://github.com/skliper/cFS/actions/runs/8381881063
https://github.com/skliper/cFS/actions/runs/8381881063

@dzbaker dzbaker added CCB:Approved Indicates code review and approval by community CCB and removed CCB:Ready Pull request is ready for discussion at the Configuration Control Board (CCB) labels Mar 28, 2024
dzbaker added a commit to nasa/cFS that referenced this pull request Mar 28, 2024
*Combines:*

cFE equuleus-rc1+dev120
osal equuleus-rc1+dev62

**Includes:**

*cFE*
- nasa/cFE#2535
- nasa/cFE#2539

*osal*
- nasa/osal#1350

Co-authored by: Joseph Hickey <[email protected]>
Co-authored by: Jacob Hageman <[email protected]>
dzbaker added a commit to nasa/cFS that referenced this pull request Apr 1, 2024
*Combines:*

cFE equuleus-rc1+dev120
osal equuleus-rc1+dev62

**Includes:**

*cFE*
- nasa/cFE#2535
- nasa/cFE#2539

*osal*
- nasa/osal#1350

Co-authored by: Joseph Hickey <[email protected]>
Co-authored by: Jacob Hageman <[email protected]>
@dzbaker dzbaker merged commit 1766a0e into nasa:main Apr 1, 2024
19 of 20 checks passed
dzbaker added a commit to nasa/cFS that referenced this pull request Apr 1, 2024
*Combines:*

cFE equuleus-rc1+dev120
osal equuleus-rc1+dev62

**Includes:**

*cFE*
- nasa/cFE#2535
- nasa/cFE#2539

*osal*
- nasa/osal#1350

Co-authored by: Joseph Hickey <[email protected]>
Co-authored by: Jacob Hageman <[email protected]>
@skliper skliper deleted the fix1349-config_rtems branch April 1, 2024 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CCB:Approved Indicates code review and approval by community CCB
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add generic RTEMS tar file system support Break up pc rtems bsp to support generic/configurable use
3 participants