f4pga/wrappers: do not use shell scripts for quicklogic's 'write_*' commands (#599)

This commit is contained in:
Unai Martinez-Corral 2022-08-02 13:30:28 +02:00 committed by GitHub
parent e276ecfb4c
commit cad8afe084
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 92 deletions

View File

@ -22,6 +22,7 @@
from sys import argv as sys_argv, stdout, stderr from sys import argv as sys_argv, stdout, stderr
from os import environ from os import environ
from pathlib import Path from pathlib import Path
from shutil import which
from subprocess import check_call from subprocess import check_call
@ -47,6 +48,12 @@ def run_sh(script):
check_call([str(script)]+sys_argv[1:], env=f4pga_environ) check_call([str(script)]+sys_argv[1:], env=f4pga_environ)
def run_pym(module):
stdout.flush()
stderr.flush()
check_call([which('python3'), '-m' , module]+sys_argv[1:], env=f4pga_environ)
def generate_constraints(): def generate_constraints():
print("[F4PGA] Running (deprecated) generate constraints") print("[F4PGA] Running (deprecated) generate constraints")
run_sh(ROOT / SH_SUBDIR / "generate_constraints.f4pga.sh") run_sh(ROOT / SH_SUBDIR / "generate_constraints.f4pga.sh")
@ -121,18 +128,23 @@ def fasm2bels():
print("[F4PGA] Running (deprecated) fasm2bels") print("[F4PGA] Running (deprecated) fasm2bels")
run_sh(ROOT / "quicklogic/fasm2bels.f4pga.sh") run_sh(ROOT / "quicklogic/fasm2bels.f4pga.sh")
def write_bitheader(): def write_bitheader():
print("[F4PGA] Running (deprecated) write bitheader") print("[F4PGA] Running (deprecated) write bitheader")
run_sh(ROOT / "quicklogic/write_bitheader.f4pga.sh") print("Converting bitstream to C Header")
run_pym('quicklogic_fasm.bitstream_to_header')
def write_binary(): def write_binary():
print("[F4PGA] Running (deprecated) write binary") print("[F4PGA] Running (deprecated) write binary")
run_sh(ROOT / "quicklogic/write_binary.f4pga.sh") print("Converting bitstream to flashable binary format")
run_pym('quicklogic_fasm.bitstream_to_binary')
def write_jlink(): def write_jlink():
print("[F4PGA] Running (deprecated) write jlink") print("[F4PGA] Running (deprecated) write jlink")
run_sh(ROOT / "quicklogic/write_jlink.f4pga.sh") print("Converting bitstream to JLink script")
run_pym('quicklogic_fasm.bitstream_to_jlink')
def write_openocd(): def write_openocd():
print("[F4PGA] Running (deprecated) write openocd") print("[F4PGA] Running (deprecated) write openocd")
run_sh(ROOT / "quicklogic/write_openocd.f4pga.sh") print("Converting bitstream to OpenOCD script")
run_pym('quicklogic_fasm.bitstream_to_openocd')

View File

@ -1,22 +0,0 @@
#!/bin/bash
#
# Copyright (C) 2020-2022 F4PGA Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
set -e
echo "Converting bitstream to flashable binary format"
`which python3` -m quicklogic_fasm.bitstream_to_binary $@

View File

@ -1,22 +0,0 @@
#!/bin/bash
#
# Copyright (C) 2020-2022 F4PGA Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
set -e
echo "Converting bitstream to C Header"
`which python3` -m quicklogic_fasm.bitstream_to_header $@

View File

@ -1,22 +0,0 @@
#!/usr/bin/env bash
#
# Copyright (C) 2020-2022 F4PGA Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
set -e
echo "Converting bitstream to JLink script"
`which python3` -m quicklogic_fasm.bitstream_to_jlink $@

View File

@ -1,22 +0,0 @@
#!/usr/bin/env bash
#
# Copyright (C) 2020-2022 F4PGA Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
set -e
echo "Converting bitstream to OpenOCD script"
`which python3` -m quicklogic_fasm.bitstream_to_openocd $@