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

Update build to include main files in pycom firmware base #112

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@
#
# Have fun!


print('[main.py] INFO: Loading settings')
import settings
try:
import settings
except ImportError:
print('[main.py] INFO: No python settings detected')
settings = None

print('[main.py] INFO: Starting logging')
from terkin import logging
Expand Down
23 changes: 12 additions & 11 deletions tools/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def __init__(self,
self.verbose = verbose

self.pycom_frozen_path = f'{self.micropython_path}/esp32/frozen/Custom'
self.pycom_frozen_base_path = f'{self.micropython_path}/esp32/frozen/Base'

def build_genuine(self, board, manifest):

Expand Down Expand Up @@ -169,27 +170,27 @@ def build_pycom(self, board):

def purge_frozen(self):

frozen_path = self.pycom_frozen_path

if not os.path.exists(frozen_path):
click.secho(f'{red("ERROR")}: Frozen path {red(frozen_path)} does not exist.')
sys.exit(2)
for frozen_path in (self.pycom_frozen_path, self.pycom_frozen_base_path):
if not os.path.exists(frozen_path):
click.secho(f'{red("ERROR")}: Frozen path {red(frozen_path)} does not exist.')
sys.exit(2)

click.secho(f'Purging contents of frozen path {frozen_path}.')
pattern = f'{frozen_path}/*'
if glob(pattern):
shell(f'rm -r {frozen_path}/*')
click.secho(f'Purging contents of frozen path {frozen_path}.')
pattern = f'{frozen_path}/*'
if glob(pattern):
shell(f'rm -r {frozen_path}/*')

def sync_frozen(self):
frozen_path = self.pycom_frozen_path
frozen_base_path = self.pycom_frozen_base_path

click.secho(f'Copying sources from {yellow(str(self.sources))} to frozen path {frozen_path}.')
shell(f'rsync -auv --delete --exclude=__pycache__ --exclude=*.egg-info --exclude=terkin_cpython --exclude=ratrack {" ".join(self.sources)} {frozen_path}')

click.secho(f'Copying main files from {yellow(str(self.main_files))} to frozen path {frozen_path}.')
click.secho(f'Copying main files from {yellow(str(self.main_files))} to frozen path {frozen_base_path}.')
for main_file in self.main_files:
filename = os.path.basename(main_file)
target_file = os.path.join(frozen_path, '_' + filename)
target_file = os.path.join(frozen_base_path, '_' + filename)
shell(f'cp {main_file} {target_file}')

# MicroWebSrv2 is too large to be frozen into the firmware, so remove it.
Expand Down