Files
se-algo/algo.py
qzh b1d0ef0d0d 初始化:添加本地配置文件
new file:   .gitignore
	new file:   .vscode/settings.json
	new file:   LICENSE
	new file:   README.md
	new file:   SConscript
	new file:   SConstruct
	new file:   algo.py
	new file:   inc/type.h
	new file:   inc/zuc256.h
	new file:   run.sh
	new file:   src/main.c
	new file:   src/zuc256.c
2025-08-31 15:44:27 +08:00

38 lines
1.2 KiB
Python
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import os
from SCons.Script import *
# 工具链配置Ubuntu gcc环境
CROSS_TOOL = 'gcc'
PREFIX = '' # 本地编译不需要交叉编译前缀
# 目标配置
TARGET_NAME = 'app' # 更改为通用应用名称
BUILD_DIR = 'build' # 统一构建输出目录
# 工具链路径使用系统默认的gcc工具链
CC = PREFIX + 'gcc'
CXX = PREFIX + 'g++'
AS = PREFIX + 'gcc'
AR = PREFIX + 'ar'
LINK = PREFIX + 'gcc'
SIZE = PREFIX + 'size'
OBJDUMP = PREFIX + 'objdump'
OBJCPY = PREFIX + 'objcopy'
# 编译、链接选项适用于Ubuntu gcc环境
DEVICE = '-std=c99 -g -O2 -fvisibility=hidden -fno-common'
CFLAGS = DEVICE + ' -Wall -Wextra' # 添加更多警告选项
AFLAGS = '-c ' + DEVICE + ' -x assembler-with-cpp'
LFLAGS = DEVICE + ' -Wl,--gc-sections,-cref,-Map=' + os.path.join(BUILD_DIR, TARGET_NAME + '.map')
# 构建后处理命令(输出到 build 目录)
ASM_FILE = os.path.join(BUILD_DIR, TARGET_NAME + '.asm')
BIN_FILE = os.path.join(BUILD_DIR, TARGET_NAME + '.bin')
DUMP_ACTION = f'{OBJDUMP} -D -S $SOURCE > {ASM_FILE}'
POST_ACTION = f'{OBJCPY} -O binary $SOURCE {BIN_FILE}\n'
POST_ACTION += f'{SIZE} $SOURCE\n'
POST_ACTION += DUMP_ACTION