[bsp][pico] Remove cmake dependency

This commit is contained in:
1ridic 2023-10-10 19:53:50 +08:00 committed by guo
parent 220222a387
commit 299700cf78
4 changed files with 12 additions and 67 deletions

View File

@ -27,7 +27,7 @@
## Supported compiler
Support GCC 6 and above compilers. CMake and Scons is needed.
Support GCC 6 and above compilers.
## Program firmware
@ -37,19 +37,7 @@ Support GCC 6 and above compilers. CMake and Scons is needed.
pkgs --update
```
### Step 2: generate necessary files
```bash
python ./tools/generate_files.py
```
Use PICO_TOOLCHAIN_PATH to specify the compilation toolchain location, for example:
```bash
env PICO_TOOLCHAIN_PATH=/opt/rt-gcc-arm-none-eabi/bin ./tools/generate_files.py
``
### Step 3: build
### Step 2: build
```bash
scons -c
@ -58,7 +46,7 @@ scons
**gcc version >= 6.x.x**
### Step 4: flash
### Step 3: flash
scons generates a UF2 file:

View File

@ -27,6 +27,15 @@ Export('rtconfig')
# prepare building environment
objs = PrepareBuilding(env, RTT_ROOT)
ocwd = os.getcwd()
os.chdir('packages/raspberrypi-pico-sdk-latest')
print("Enter " + os.getcwd())
if GetOption('clean'):
os.system("scons -c")
else:
os.system("scons")
os.chdir(ocwd)
objs.extend(SConscript(os.path.join(os.getcwd(), 'board', 'ports', 'SConscript')))
# make a building

View File

@ -1,14 +0,0 @@
import rtconfig
Import('RTT_ROOT')
from building import *
# get current directory
cwd = GetCurrentDir()
path = [
cwd + '/generated/pico_base'
]
group = DefineGroup('generated', ['generated/bs2_default_padded_checksummed.S'], depend = [''], CPPPATH = path)
Return('group')

View File

@ -1,38 +0,0 @@
#! /usr/bin/env python3
import os
import sys
import shutil
# get the path of current file
cmd = os.path.split(os.path.realpath(__file__))[0]
if not os.path.exists(os.path.join(cmd, '../packages/raspberrypi-pico-sdk-latest')):
print('Error: raspberrypi-pico-sdk not found, please run "pkgs --update" first')
exit(1)
if os.path.exists(os.path.join(cmd, 'build')):
shutil.rmtree(os.path.join(cmd, 'build'))
os.mkdir(os.path.join(cmd, 'build'))
os.chdir(os.path.join(cmd, 'build'))
# run cmake
os.system('cmake ' + os.path.join(cmd, '../packages/raspberrypi-pico-sdk-latest'))
os.system('make ELF2UF2Build bs2_default_padded_checksummed_asm')
# copy header files
shutil.copytree(os.path.join(cmd, 'build', 'generated'), os.path.join(cmd, 'generated'), dirs_exist_ok = True)
# copy the generated files to the destination
if "linux" in sys.platform:
shutil.copyfile(os.path.join(cmd, 'build', 'elf2uf2', 'elf2uf2'), os.path.join(cmd, 'elf2uf2'))
if "win32" in sys.platform:
shutil.copyfile(os.path.join(cmd, 'build', 'elf2uf2', 'elf2uf2.exe'), os.path.join(cmd, 'elf2uf2.exe'))
# copy bs2_default_padded_checksummed_asm
shutil.copyfile(os.path.join(cmd, 'build', 'src', 'rp2_common', 'boot_stage2', 'bs2_default_padded_checksummed.S'), \
os.path.join(cmd, 'generated', 'bs2_default_padded_checksummed.S'))
# clean up
shutil.rmtree(os.path.join(cmd, 'build'))