Browse Source

[bsp][pico] Remove cmake dependency

1ridic 1 year ago
parent
commit
299700cf78

+ 3 - 15
bsp/raspberry-pico/README.md

@@ -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:
 

+ 9 - 0
bsp/raspberry-pico/SConstruct

@@ -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

+ 0 - 14
bsp/raspberry-pico/tools/SConscript

@@ -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')

+ 0 - 38
bsp/raspberry-pico/tools/generate_files.py

@@ -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'))