console关闭版本

This commit is contained in:
hyl 2024-12-24 02:38:36 +00:00
parent 3f08641909
commit 8752a17203
3 changed files with 22 additions and 72 deletions

View File

@ -1,50 +0,0 @@
#!/bin/bash
# 定义目标目录
target_dir="/mnt/hgfs/share"
# 检查目标目录是否存在
if [ ! -d "$target_dir" ]; then
echo "错误: 目标目录 $target_dir 不存在,脚本将退出。"
exit 1
fi
# 执行 make clean 操作
# echo "执行 make BOARD=stm32f103-nano clean..."
# make BOARD=stm32f103-nano clean
# if [ $? -ne 0 ]; then
# echo "错误: make BOARD=stm32f103-nano clean 失败,脚本将退出。"
# exit 1
# fi
# 执行 make 操作
echo "执行 make BOARD=stm32f103-nano ..."
make BOARD=stm32f103-nano
if [ $? -ne 0 ]; then
echo "错误: make BOARD=stm32f103-nano 失败,脚本将退出。"
exit 1
fi
arm-none-eabi-objdump -d ./build/XiZi-stm32f103-nano.elf > ./build/obj.S
# 定义源文件路径和名称
source_files=(
"./build/obj.S"
"./build/XiZi-stm32f103-nano.bin"
"./build/XiZi-stm32f103-nano.elf"
"./build/XiZi-stm32f103-nano.hex"
"./build/XiZi-stm32f103-nano.map"
)
# 复制文件,如果有同名文件则覆盖
for file in "${source_files[@]}"; do
if [ -f "$file" ]; then
cp -f "$file" "$target_dir"
echo "文件 $file 已复制到 $target_dir(如果已存在则被覆盖)"
else
echo "警告: 文件 $file 不存在,跳过复制操作。"
fi
done

View File

@ -124,8 +124,8 @@ typedef x_base x_OffPos;
#endif #endif
#define WAITING_FOREVER -1 #define WAITING_FOREVER -1
// #define KPrintf printf #define KPrintf printf
void KPrintf(const char *fmt, ...); // void KPrintf(const char *fmt, ...);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -658,29 +658,29 @@ int VsnPrintf(char *buf, int32 size, const char *fmt, va_list args)
#endif #endif
void KPrintf(const char *fmt, ...) // void KPrintf(const char *fmt, ...)
{ // {
#ifdef KERNEL_CONSOLE // #ifdef KERNEL_CONSOLE
if(_console != NONE) { // if(_console != NONE) {
va_list args; // va_list args;
x_size_t length = 0; // x_size_t length = 0;
static char logbuf[KERNEL_CONSOLEBUF_SIZE] = {0}; // static char logbuf[KERNEL_CONSOLEBUF_SIZE] = {0};
va_start(args, fmt); // va_start(args, fmt);
length = VsnPrintf(logbuf, sizeof(logbuf) - 1, fmt, args); // length = VsnPrintf(logbuf, sizeof(logbuf) - 1, fmt, args);
if (length > KERNEL_CONSOLEBUF_SIZE - 1) // if (length > KERNEL_CONSOLEBUF_SIZE - 1)
length = KERNEL_CONSOLEBUF_SIZE - 1; // length = KERNEL_CONSOLEBUF_SIZE - 1;
struct BusBlockWriteParam write_param; // struct BusBlockWriteParam write_param;
write_param.pos = 0; // write_param.pos = 0;
write_param.buffer = (void *)logbuf; // write_param.buffer = (void *)logbuf;
write_param.size = length; // write_param.size = length;
BusDevWriteData(_console, (void *)&write_param); // BusDevWriteData(_console, (void *)&write_param);
va_end(args); // va_end(args);
} // }
#endif // #endif
} // }