From 7522bf9c1f62d909dadd396a722e417dcf712642 Mon Sep 17 00:00:00 2001 From: zhangzheng <1358745329@qq.comwq> Date: Tue, 5 Dec 2023 00:01:26 +0800 Subject: [PATCH] kernel support kconfig --- .config | 16 +- .config.old | 6 + .vscode/settings.json | 3 +- CMakeLists.txt | 1 + Kconfig | 5 +- install.sh | 496 ------------------ mkrtos_knl/CMakeLists.txt | 3 +- mkrtos_knl/Kconfig | 45 ++ mkrtos_knl/arch/armv7m/arch.c | 2 +- mkrtos_knl/arch/armv7m/mpu.c | 2 +- mkrtos_knl/inc/knl/config.h | 2 +- mkrtos_knl/inc/knl/futex.h | 2 + mkrtos_knl/inc/knl/irq.h | 4 +- mkrtos_knl/inc/knl/mm_space.h | 4 +- mkrtos_knl/inc/knl/obj_space.h | 10 +- mkrtos_knl/inc/knl/printk.h | 1 + mkrtos_knl/knl/CMakeLists.txt | 1 - mkrtos_knl/knl/futex.c | 15 +- mkrtos_knl/knl/irq.c | 10 +- mkrtos_knl/knl/mm_space.c | 2 +- mkrtos_knl/knl/obj_space.c | 16 +- mkrtos_knl/knl/printk.c | 2 +- mkrtos_script/build.sh | 8 +- mkrtos_user/lib/libc_backend/src/fd_map.c | 34 +- mkrtos_user/lib/sys/inc/u_arch.h | 2 +- mkrtos_user/lib/sys_util/src/u_sleep.c | 2 +- .../libraries/HAL_Drivers/CMakeLists.txt | 2 - mkrtos_user/server/init/src/cons.c | 2 +- setting.cmake | 3 + 29 files changed, 138 insertions(+), 563 deletions(-) delete mode 100644 install.sh create mode 100644 mkrtos_knl/Kconfig diff --git a/.config b/.config index db6eedf40..c54b4bb27 100644 --- a/.config +++ b/.config @@ -3,7 +3,8 @@ CONFIG_RTT_DIR="./" # # Libc backend # -CONFIG_MKRTOS_LIBC_FD_MAP_NR=128 +CONFIG_FD_MAP_ROW_CN=16 +CONFIG_FD_MAP_ROW_NR=16 # end of Libc backend # @@ -76,3 +77,16 @@ CONFIG_RT_USING_PIN=y # CONFIG_RT_USING_USB_DEVICE is not set # end of Using USB # end of Device Drivers + +# +# Knl config +# +CONFIG_FT_ADDR_NR=16 +CONFIG_SYS_SCHE_HZ=1000 +CONFIG_USER_ISR_START_NO=16 +CONFIG_IRQ_REG_TAB_SIZE=80 +CONFIG_REGION_NUM=8 +CONFIG_OBJ_MAP_TAB_SIZE=4 +CONFIG_OBJ_MAP_ENTRY_SIZE=8 +CONFIG_PRINTK_CACHE_SIZE=128 +# end of Knl config diff --git a/.config.old b/.config.old index 4fdf7e149..db6eedf40 100644 --- a/.config.old +++ b/.config.old @@ -1,5 +1,11 @@ CONFIG_RTT_DIR="./" +# +# Libc backend +# +CONFIG_MKRTOS_LIBC_FD_MAP_NR=128 +# end of Libc backend + # # DFS: device virtual file system # diff --git a/.vscode/settings.json b/.vscode/settings.json index 58c6b3ba4..53bd8c884 100755 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -269,7 +269,8 @@ "shell_fs.h": "c", "shell_passthrough.h": "c", "u_slist.h": "c", - "atomic": "c" + "atomic": "c", + "futex.h": "c" }, "cortex-debug.showRTOS": false, "cortex-debug.variableUseNaturalFormat": false, diff --git a/CMakeLists.txt b/CMakeLists.txt index 2557a42c3..17f063007 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,7 @@ string(STRIP ${TIME} TIME) set(code_version ${BRANCH}-${COMMIT} CACHE STRING " " FORCE) set(compile_time "${DATE}\" \"${TIME}" CACHE STRING " " FORCE) + add_subdirectory(mkrtos_bootstrap) add_subdirectory(mkrtos_knl) add_subdirectory(mkrtos_img) diff --git a/Kconfig b/Kconfig index 188eb9296..a88b375b2 100644 --- a/Kconfig +++ b/Kconfig @@ -1,8 +1,9 @@ mainmenu "MKRTOS Project Configuration" - +source "mkrtos_knl/Kconfig" +source "mkrtos_user/Kconfig" config RTT_DIR string default "./" -source "mkrtos_user/Kconfig" + diff --git a/install.sh b/install.sh deleted file mode 100644 index 419b85bef..000000000 --- a/install.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin -export PATH -LANG=en_US.UTF-8 - - -echo " -+---------------------------------------------------------------------- -| Bt-WebPanel 5.x FOR Ubuntu/Debian -+---------------------------------------------------------------------- -| Copyright © 2015-2018 BT-SOFT(http://www.bt.cn) All rights reserved. -+---------------------------------------------------------------------- -| The WebPanel URL will be http://SERVER_IP:8888 when installed. -+---------------------------------------------------------------------- -" -deepinSys=`cat /etc/issue` -if [[ "${deepinSys}" =~ eepin ]]; then - isroot='' - if [ `whoami` != "root" ];then - isroot='sudo ' - fi - if [ -f "/etc/init.d/bt" ]; then - password=`${isroot}cat /www/server/panel/default.pl` - port=`${isroot}cat /www/server/panel/data/port.pl` - echo -e "==================================================================" - echo -e "Bt-Panel: http://localhost:$port" - echo -e "默认账户: admin" - echo -e "默认密码: $password" - echo -e "==================================================================" - echo -e "正在尝试打开浏览器..." - if [ -f "/opt/google/chrome/chrome" ]; then - ${isroot}/opt/google/chrome/chrome --no-sandbox http://localhost:$port - exit; - fi - if [ -f "/usr/lib/firefox/firefox" ]; then - /usr/lib/firefox/firefox http://localhost:$port - exit; - fi - echo -e "找不到chrome/firefox浏览器,请自行打开浏览器访问宝塔面板: http://loshost:$port" - exit; - - fi -fi -if [ `whoami` != "root" ];then - echo -e "\033[31mError: Please run the script with root privileges on Ubuntu, for example: sudo bash install.sh\033[0m"; - exit; -fi - -#自动选择下载节点 -get_node_url(){ - nodes=(http://125.88.182.172:5880 http://103.224.251.67 http://128.1.164.196 http://download.bt.cn); - i=1; - if [ ! -f /bin/curl ];then - if [ -f /usr/local/curl/bin/curl ];then - ln -sf /usr/local/curl/bin/curl /bin/curl - else - yum install curl -y - fi - fi - for node in ${nodes[@]}; - do - start=`date +%s.%N` - result=`curl -sS --connect-timeout 3 -m 60 $node/check.txt` - if [ $result = 'True' ];then - end=`date +%s.%N` - start_s=`echo $start | cut -d '.' -f 1` - start_ns=`echo $start | cut -d '.' -f 2` - end_s=`echo $end | cut -d '.' -f 1` - end_ns=`echo $end | cut -d '.' -f 2` - time_micro=$(( (10#$end_s-10#$start_s)*1000000 + (10#$end_ns/1000 - 10#$start_ns/1000) )) - time_ms=$(($time_micro/1000)) - values[$i]=$time_ms; - urls[$time_ms]=$node - i=$(($i+1)) - fi - done - j=5000 - for n in ${values[@]}; - do - if [ $j -gt $n ];then - j=$n - fi - done - if [ $j = 5000 ];then - NODE_URL='http://download.bt.cn'; - else - NODE_URL=${urls[$j]} - fi - -} - -echo '---------------------------------------------'; -echo "Selected download node..."; -get_node_url -download_Url=$NODE_URL -echo "Download node: $download_Url"; -echo '---------------------------------------------'; -setup_path=/www -port='8888' -if [ -f $setup_path/server/panel/data/port.pl ];then - port=`cat $setup_path/server/panel/data/port.pl` -fi - -while [ "$go" != 'y' ] && [ "$go" != 'n' ] -do - read -p "Do you want to install Bt-Panel to the $setup_path directory now?(y/n): " go; -done - -if [ "$go" = 'n' ];then - exit; -fi -startTime=`date +%s` - -#数据盘自动分区 -fdiskP(){ - - for i in `cat /proc/partitions|grep -v name|grep -v ram|awk '{print $4}'|grep -v '^$'|grep -v '[0-9]$'|grep -e 'vd' -e 'sd' -e 'xv'`; - do - #判断/www是否被挂载 - isR=`df -P|grep $setup_path` - if [ "$isR" != "" ];then - echo 'Warning: The /www directory has been mounted.' - return; - fi - #判断是否存在未分区磁盘 - isP=`fdisk -l /dev/$i |grep -v 'bytes'|grep "$i[1-9]*"` - if [ "$isP" = "" ];then - #开始分区 - fdisk -S 56 /dev/$i << EOF -n -p -1 - - -wq -EOF - - sleep 5 - #检查是否分区成功 - checkP=`fdisk -l /dev/$i|grep "/dev/${i}1"` - if [ "$checkP" != "" ];then - #格式化分区 - mkfs.ext4 /dev/${i}1 - mkdir $setup_path - #挂载分区 - sed -i "/\/dev\/${i}1/d" /etc/fstab - echo "/dev/${i}1 $setup_path ext4 defaults 0 0" >> /etc/fstab - mount -a - df -h - fi - else - #判断是否存在Windows磁盘分区 - isN=`fdisk -l /dev/$i|grep -v 'bytes'|grep -v "NTFS"|grep -v "FAT32"` - if [ "$isN" = "" ];then - echo 'Warning: The Windows partition was detected. For your data security, Mount manually.'; - return; - fi - - #挂载已有分区 - checkR=`df -P|grep "/dev/$i"` - if [ "$checkR" = "" ];then - mkdir $setup_path - sed -i "/\/dev\/${i}1/d" /etc/fstab - echo "/dev/${i}1 $setup_path ext4 defaults 0 0" >> /etc/fstab - mount -a - df -h - fi - - #清理不可写分区 - echo 'True' > $setup_path/checkD.pl - if [ ! -f $setup_path/checkD.pl ];then - sed -i "/\/dev\/${i}1/d" /etc/fstab - mount -a - df -h - else - rm -f $setup_path/checkD.pl - fi - fi - done -} -#fdiskP - -ln -sf bash /bin/sh -apt-get install ruby -y -apt-get update -y -apt-get install lsb-release -y -#apt-get install ntp ntpdate -y -#/etc/init.d/ntp stop -#update-rc.d ntp remove -#cat >>~/.profile<&1|awk '{print $2}') -pVersion=${tmp:0:3} - -Install_setuptools() -{ - if [ ! -f "/usr/bin/easy_install" ];then - wget -O setuptools-33.1.1.zip $download_Url/install/src/setuptools-33.1.1.zip -T 10 - unzip setuptools-33.1.1.zip - rm -f setuptools-33.1.1.zip - cd setuptools-33.1.1 - python setup.py install - cd .. - rm -rf setuptools-33.1.1 - fi - - if [ ! -f "/usr/bin/easy_install" ];then - echo '================================================='; - echo -e "\033[31msetuptools installation failed. \033[0m"; - exit; - fi -} -Install_Pillow() -{ - isSetup=`python -m PIL 2>&1|grep package` - if [ "$isSetup" = "" ];then - wget -O Pillow-3.2.0.zip $download_Url/install/src/Pillow-3.2.0.zip -T 10 - unzip Pillow-3.2.0.zip - rm -f Pillow-3.2.0.zip - cd Pillow-3.2.0 - python setup.py install - cd .. - rm -rf Pillow-3.2.0 - fi - isSetup=`python -m PIL 2>&1|grep package` - if [ "$isSetup" = "" ];then - echo '================================================='; - echo -e "\033[31mPillow installation failed. \033[0m"; - exit; - fi -} - -Install_psutil() -{ - isSetup=`python -m psutil 2>&1|grep package` - if [ "$isSetup" = "" ];then - wget -O psutil-5.2.2.tar.gz $download_Url/install/src/psutil-5.2.2.tar.gz -T 10 - tar xvf psutil-5.2.2.tar.gz - rm -f psutil-5.2.2.tar.gz - cd psutil-5.2.2 - python setup.py install - cd .. - rm -rf psutil-5.2.2 - fi - isSetup=`python -m psutil 2>&1|grep package` - if [ "$isSetup" = "" ];then - echo '================================================='; - echo -e "\033[31mpsutil installation failed. \033[0m"; - exit; - fi -} - -Install_mysqldb() -{ - isSetup=`python -m MySQLdb 2>&1|grep package` - if [ "$isSetup" = "" ];then - wget -O MySQL-python-1.2.5.zip $download_Url/install/src/MySQL-python-1.2.5.zip -T 10 - unzip MySQL-python-1.2.5.zip - rm -f MySQL-python-1.2.5.zip - cd MySQL-python-1.2.5 - python setup.py install - cd .. - rm -rf MySQL-python-1.2.5 - fi - -} - -Install_chardet() -{ - isSetup=`python -m chardet 2>&1|grep package` - if [ "$isSetup" = "" ];then - wget -O chardet-2.3.0.tar.gz $download_Url/install/src/chardet-2.3.0.tar.gz -T 10 - tar xvf chardet-2.3.0.tar.gz - rm -f chardet-2.3.0.tar.gz - cd chardet-2.3.0 - python setup.py install - cd .. - rm -rf chardet-2.3.0 - fi - isSetup=`python -m chardet 2>&1|grep package` - if [ "$isSetup" = "" ];then - echo '================================================='; - echo -e "\033[31mchardet installation failed. \033[0m"; - exit; - fi -} - -Install_webpy() -{ - isSetup=`python -m web 2>&1|grep package` - if [ "$isSetup" = "" ];then - wget -O web.py-0.38.tar.gz $download_Url/install/src/web.py-0.38.tar.gz -T 10 - tar xvf web.py-0.38.tar.gz - rm -f web.py-0.38.tar.gz - cd web.py-0.38 - python setup.py install - cd .. - rm -rf web.py-0.38 - fi - - isSetup=`python -m web 2>&1|grep package` - if [ "$isSetup" = "" ];then - echo '================================================='; - echo -e "\033[31mweb.py installation failed. \033[0m"; - exit; - fi -} -pipArg='' - - -pip install setuptools -#pip install --upgrade pip $pipArg -pip install psutil chardet web.py virtualenv Pillow $pipArg - - -Install_Pillow -Install_psutil -if [ -f /www/server/mysql/bin/mysql ]; then - pip install mysql-python - Install_mysqldb -fi -Install_chardet -Install_webpy - -mkdir -p $setup_path/server/panel/logs -mkdir -p $setup_path/server/panel/vhost/apache -mkdir -p $setup_path/server/panel/vhost/nginx -mkdir -p $setup_path/server/panel/vhost/rewrite -wget -O $setup_path/server/panel/certbot-auto $download_Url/install/certbot-auto.init -T 5 -chmod +x $setup_path/server/panel/certbot-auto - - -if [ -f '/etc/init.d/bt' ];then - /etc/init.d/bt stop -fi - -mkdir -p /www/server -mkdir -p /www/wwwroot -mkdir -p /www/wwwlogs -mkdir -p /www/backup/database -mkdir -p /www/backup/site - -wget -O panel.zip $download_Url/install/src/panel.zip -T 10 -wget -O /etc/init.d/bt $download_Url/install/src/bt.init -T 10 -if [ -f "$setup_path/server/panel/data/default.db" ];then - if [ -d "/$setup_path/server/panel/old_data" ];then - rm -rf $setup_path/server/panel/old_data - fi - mkdir -p $setup_path/server/panel/old_data - mv -f $setup_path/server/panel/data/default.db $setup_path/server/panel/old_data/default.db - mv -f $setup_path/server/panel/data/system.db $setup_path/server/panel/old_data/system.db - mv -f $setup_path/server/panel/data/aliossAs.conf $setup_path/server/panel/old_data/aliossAs.conf - mv -f $setup_path/server/panel/data/qiniuAs.conf $setup_path/server/panel/old_data/qiniuAs.conf - mv -f $setup_path/server/panel/data/iplist.txt $setup_path/server/panel/old_data/iplist.txt - mv -f $setup_path/server/panel/data/port.pl $setup_path/server/panel/old_data/port.pl -fi - -unzip -o panel.zip -d $setup_path/server/ > /dev/null - -if [ -d "$setup_path/server/panel/old_data" ];then - mv -f $setup_path/server/panel/old_data/default.db $setup_path/server/panel/data/default.db - mv -f $setup_path/server/panel/old_data/system.db $setup_path/server/panel/data/system.db - mv -f $setup_path/server/panel/old_data/aliossAs.conf $setup_path/server/panel/data/aliossAs.conf - mv -f $setup_path/server/panel/old_data/qiniuAs.conf $setup_path/server/panel/data/qiniuAs.conf - mv -f $setup_path/server/panel/old_data/iplist.txt $setup_path/server/panel/data/iplist.txt - mv -f $setup_path/server/panel/old_data/port.pl $setup_path/server/panel/data/port.pl - - if [ -d "/$setup_path/server/panel/old_data" ];then - rm -rf $setup_path/server/panel/old_data - fi -fi - -rm -f panel.zip - -if [ ! -f $setup_path/server/panel/tools.py ];then - echo -e "\033[31mERROR: Failed to download, please try again!\033[0m"; - echo '============================================' - exit; -fi - -rm -f $setup_path/server/panel/class/*.pyc -rm -f $setup_path/server/panel/*.pyc -python -m compileall $setup_path/server/panel -#rm -f $setup_path/server/panel/class/*.py -#rm -f $setup_path/server/panel/*.py - -chmod 777 /tmp -chmod +x /etc/init.d/bt -update-rc.d bt defaults -chmod -R 600 $setup_path/server/panel -chmod +x $setup_path/server/panel/certbot-auto -chmod -R +x $setup_path/server/panel/script -echo "$port" > $setup_path/server/panel/data/port.pl -/etc/init.d/bt start -password=`cat /dev/urandom | head -n 16 | md5sum | head -c 8` -cd $setup_path/server/panel/ -python tools.py username -username=`python tools.pyc panel $password` -cd ~ -echo "$password" > $setup_path/server/panel/default.pl -chmod 600 $setup_path/server/panel/default.pl - -isStart=`ps aux |grep 'python main.pyc'|grep -v grep|awk '{print $2}'` -if [ "$isStart" == '' ];then - echo -e "\033[31mERROR: The BT-Panel service startup failed.\033[0m"; - echo '============================================' - exit; -fi - -if [ ! -f "/usr/bin/ufw" ];then - apt-get install -y ufw -fi - -if [ -f "/usr/sbin/ufw" ];then - ufw allow 888,20,21,22,80,$port/tcp - ufw allow 39000:40000/tcp - ufw_status=`ufw status` - echo y|ufw enable - ufw default deny - ufw reload -fi -pip install web.py==0.39 -pip install psutil chardet psutil virtualenv $pipArg -if [ ! -d '/etc/letsencrypt' ];then - - mkdir -p /var/spool/cron - if [ ! -f '/var/spool/cron/crontabs/root' ];then - echo '' > /var/spool/cron/crontabs/root - chmod 600 /var/spool/cron/crontabs/root - fi - isCron=`cat /var/spool/cron/crontabs/root|grep certbot.log` - if [ "${isCron}" == "" ];then - echo "30 2 * * * $setup_path/server/panel/certbot-auto renew >> $setup_path/server/panel/logs/certbot.log" >> /var/spool/cron/crontabs/root - chown 600 /var/spool/cron/crontabs/root - fi - service cron restart - nohup $setup_path/server/panel/certbot-auto -n > /tmp/certbot-auto.log 2>&1 & -fi -if [[ "${deepinSys}" =~ eepin ]]; then - address="localhost" -else - address=`curl -sS --connect-timeout 10 -m 60 https://www.bt.cn/Api/getIpAddress` - - if [ "$address" == '0.0.0.0' ] || [ "$address" == '' ];then - isHosts=`cat /etc/hosts|grep 'www.bt.cn'` - if [ "$isHosts" == '' ];then - echo "" >> /etc/hosts - echo "125.88.182.170 www.bt.cn" >> /etc/hosts - address=`curl -sS --connect-timeout 10 -m 60 https://www.bt.cn/Api/getIpAddress` - if [ "$address" == '' ];then - sed -i "/bt.cn/d" /etc/hosts - fi - fi - fi - - ipCheck=`python -c "import re; print re.match('^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$','$address')"` - if [ "$address" == "None" ];then - address="SERVER_IP" - fi - if [ "$address" != "SERVER_IP" ];then - echo "$address" > $setup_path/server/panel/data/iplist.txt - fi -fi - -curl -sS --connect-timeout 10 -m 60 https://www.bt.cn/Api/SetupCount?type=Linux\&o=$1 > /dev/null 2>&1 -if [ $1 != "" ];then - echo $1 > /www/server/panel/data/o.pl - cd /www/server/panel - python tools.py o -fi - -echo -e "==================================================================" -echo -e "\033[32mCongratulations! Install succeeded!\033[0m" -echo -e "==================================================================" -echo -e "Bt-Panel: http://$address:$port" -echo -e "username: $username" -echo -e "password: $password" -echo -e "\033[33mWarning:\033[0m" -echo -e "\033[33mIf you cannot access the panel, \033[0m" -echo -e "\033[33mrelease the following port (8888|888|80|443|20|21) in the security group\033[0m" -echo -e "==================================================================" - -endTime=`date +%s` -((outTime=($endTime-$startTime)/60)) -echo -e "Time consumed:\033[32m $outTime \033[0mMinute!" -rm -f install.sh diff --git a/mkrtos_knl/CMakeLists.txt b/mkrtos_knl/CMakeLists.txt index 381081210..111d4cf58 100755 --- a/mkrtos_knl/CMakeLists.txt +++ b/mkrtos_knl/CMakeLists.txt @@ -2,7 +2,8 @@ cmake_minimum_required(VERSION 3.13) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} \ -Werror \ --D__MPU_PRESENT=1 -DUSE_STDPERIPH_DRIVER=1 \ +-D__MPU_PRESENT=1 \ +-DUSE_STDPERIPH_DRIVER=1 \ -DKNL_OFFSET=$ENV{KEN_OFFSET} \ -DKNL_TEXT=$ENV{KNL_TEXT} \ -DINIT_OFFSET=$ENV{INIT_OFFSET} \ diff --git a/mkrtos_knl/Kconfig b/mkrtos_knl/Kconfig new file mode 100644 index 000000000..73d94b286 --- /dev/null +++ b/mkrtos_knl/Kconfig @@ -0,0 +1,45 @@ +menu "Knl config" + +config FT_ADDR_NR + int "The number of addresses supported by futex." + default 16 + help + Set the number of supported futex, which usually indicates how many user state locks are supported.. +config SYS_SCHE_HZ + int "System time slice size" + default 1000 + help + Set the time slice size of the system. + +config USER_ISR_START_NO + int "The starting point of the user mode interrupt number." + default 16 + help + This number indicates which interrupt number can be used for user status. +config IRQ_REG_TAB_SIZE + int "The size of the interrupt registry in the kernel." + default 80 + help + The interruption of user registration will temporarily use this table. +config REGION_NUM + int "Number of MPU regions" + default 8 + help + Set the number of regions protected by MPU. + +config OBJ_MAP_TAB_SIZE + int "The number of obj mapping tables." + default 4 + help + OBJ_MAP_TAB_SIZE * OBJ_MAP_ENTRY_SIZE is equal to the number of kernel objects that a task can map. +config OBJ_MAP_ENTRY_SIZE + int "The size of the entries in the mapping table." + default 8 + help + OBJ_MAP_TAB_SIZE * OBJ_MAP_ENTRY_SIZE is equal to the number of kernel objects that a task can map. +config PRINTK_CACHE_SIZE + int "The cache size of printk." + default 128 + help + The printk cache size refers to the size of the data content output to the console in a single attempt, which usually does not need to be modified. +endmenu diff --git a/mkrtos_knl/arch/armv7m/arch.c b/mkrtos_knl/arch/armv7m/arch.c index 7dd3f4b7b..553bfc5aa 100644 --- a/mkrtos_knl/arch/armv7m/arch.c +++ b/mkrtos_knl/arch/armv7m/arch.c @@ -38,7 +38,7 @@ void sys_startup(void) // 开启pensv中断 write_reg(REG1_ADDR, 0x10000000); // 初始化systick时钟 - SysTick_Config(SystemCoreClock / SYS_SCHE_HZ); + SysTick_Config(SystemCoreClock / CONFIG_SYS_SCHE_HZ); } void arch_disable_irq(int inx) diff --git a/mkrtos_knl/arch/armv7m/mpu.c b/mkrtos_knl/arch/armv7m/mpu.c index a6c0924c2..88206a507 100755 --- a/mkrtos_knl/arch/armv7m/mpu.c +++ b/mkrtos_knl/arch/armv7m/mpu.c @@ -45,7 +45,7 @@ void mpu_region_clr(int inx) void mpu_switch_to_task(struct task *tk) { mpu_disable(); - for (int i = 0; i < REGION_NUM; i++) + for (int i = 0; i < CONFIG_REGION_NUM; i++) { if (tk->mm_space.pt_regions[i].region_inx >= 0) { diff --git a/mkrtos_knl/inc/knl/config.h b/mkrtos_knl/inc/knl/config.h index 18aa92a50..9dba42b2e 100644 --- a/mkrtos_knl/inc/knl/config.h +++ b/mkrtos_knl/inc/knl/config.h @@ -1,3 +1,3 @@ #pragma once -#define SYS_SCHE_HZ 1000 //!< 系统调度频率 +// #define CONFIG_SYS_SCHE_HZ 1000 //!< 系统调度频率 diff --git a/mkrtos_knl/inc/knl/futex.h b/mkrtos_knl/inc/knl/futex.h index 4df4eb6e9..1d006f078 100644 --- a/mkrtos_knl/inc/knl/futex.h +++ b/mkrtos_knl/inc/knl/futex.h @@ -1,3 +1,5 @@ #pragma once +// #define CONFIG_FT_ADDR_NR 16 //!< 最多加锁的对象 + void futex_timeout_times_tick(void); diff --git a/mkrtos_knl/inc/knl/irq.h b/mkrtos_knl/inc/knl/irq.h index 9bf1b8684..5463c9046 100755 --- a/mkrtos_knl/inc/knl/irq.h +++ b/mkrtos_knl/inc/knl/irq.h @@ -4,8 +4,8 @@ #include #define IRQ_INVALID_NO ((umword_t)(-1)) -#define IRQ_REG_TAB_SIZE 80 -#define USER_ISR_START_NO 16 +// #define CONFIG_IRQ_REG_TAB_SIZE 80 +// #define CONFIG_USER_ISR_START_NO 16 bool_t irq_check_usability(int inx); bool_t irq_alloc(int inx, irq_sender_t *irq, diff --git a/mkrtos_knl/inc/knl/mm_space.h b/mkrtos_knl/inc/knl/mm_space.h index e161a17a6..d784d80ef 100644 --- a/mkrtos_knl/inc/knl/mm_space.h +++ b/mkrtos_knl/inc/knl/mm_space.h @@ -3,7 +3,7 @@ #include "types.h" #include "mm_page.h" #include -#define REGION_NUM 8 //!< 默认为8 +// #define CONFIG_REGION_NUM 8 //!< 默认为8 typedef struct region_info { umword_t start_addr; //!< 内存申请的开始地址 @@ -18,7 +18,7 @@ typedef struct region_info typedef struct mm_space { - region_info_t pt_regions[REGION_NUM]; //!< mpu内存保护块 + region_info_t pt_regions[CONFIG_REGION_NUM]; //!< mpu内存保护块 // mm_pages_t mm_pages; //!< 模拟分页内存 void *mm_block; //!< task 的私有内存块 size_t mm_block_size; //!< 私有内存块的大小 diff --git a/mkrtos_knl/inc/knl/obj_space.h b/mkrtos_knl/inc/knl/obj_space.h index 8df53bb8e..263fea88b 100755 --- a/mkrtos_knl/inc/knl/obj_space.h +++ b/mkrtos_knl/inc/knl/obj_space.h @@ -6,10 +6,10 @@ #include "types.h" #include "mm_wrap.h" -#define OBJ_MAP_TAB_SIZE 4 -#define OBJ_MAP_ENTRY_SIZE 8 +// #define CONFIG_OBJ_MAP_TAB_SIZE 4 +// #define CONFIG_OBJ_MAP_ENTRY_SIZE 8 -#define OBJ_MAP_MAX_ADDR ((OBJ_MAP_ENTRY_SIZE) * (OBJ_MAP_TAB_SIZE)) +#define OBJ_MAP_MAX_ADDR ((CONFIG_OBJ_MAP_ENTRY_SIZE) * (CONFIG_OBJ_MAP_TAB_SIZE)) enum obj_attrs { @@ -50,12 +50,12 @@ static inline uint8_t obj_map_entry_get_attr(obj_map_entry_t *entry) typedef struct obj_map_item { - obj_map_entry_t items[OBJ_MAP_ENTRY_SIZE]; + obj_map_entry_t items[CONFIG_OBJ_MAP_ENTRY_SIZE]; } obj_map_item_t; typedef struct obj_map_tab { - obj_map_item_t *tabs[OBJ_MAP_TAB_SIZE]; + obj_map_item_t *tabs[CONFIG_OBJ_MAP_TAB_SIZE]; } obj_map_tab_t; typedef struct obj_space diff --git a/mkrtos_knl/inc/knl/printk.h b/mkrtos_knl/inc/knl/printk.h index 6aa6438e9..8e4c70fe0 100755 --- a/mkrtos_knl/inc/knl/printk.h +++ b/mkrtos_knl/inc/knl/printk.h @@ -11,6 +11,7 @@ #pragma once #include "types.h" +// #define CONFIG_PRINTK_CACHE_SIZE 128 void putc(int c); int getc(void); diff --git a/mkrtos_knl/knl/CMakeLists.txt b/mkrtos_knl/knl/CMakeLists.txt index 8ad5cac18..8a9cae75d 100755 --- a/mkrtos_knl/knl/CMakeLists.txt +++ b/mkrtos_knl/knl/CMakeLists.txt @@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.13) file(GLOB_RECURSE deps *.c *.S) - add_library(knl STATIC ${deps}) target_include_directories( knl diff --git a/mkrtos_knl/knl/futex.c b/mkrtos_knl/knl/futex.c index c34a113cb..c111fda73 100644 --- a/mkrtos_knl/knl/futex.c +++ b/mkrtos_knl/knl/futex.c @@ -19,7 +19,7 @@ #include "assert.h" #include "slist.h" #include "spinlock.h" -#include "futex_queue.h" +// #include "futex_queue.h" #include "globals.h" #include "string.h" #include "ipc.h" @@ -27,8 +27,7 @@ #include "slist.h" #include "access.h" #include "limits.h" - -#define FT_ADDR_NR 16 //!< 最多加锁的对象 +#include "futex.h" #define FUTEX_WAIT 0 #define FUTEX_WAKE 1 @@ -67,7 +66,7 @@ typedef struct futex_lock typedef struct futex { kobject_t kobj; - futex_lock_t fl_list[FT_ADDR_NR]; //!< 存储加锁的地址 + futex_lock_t fl_list[CONFIG_FT_ADDR_NR]; //!< 存储加锁的地址 } futex_t; static futex_t futex_obj; @@ -173,7 +172,7 @@ static futex_lock_t *futex_set_addr(futex_t *ft, void *uaddr, thread_t *hd) { int empty_inx = -1; - for (int i = 0; i < FT_ADDR_NR; i++) + for (int i = 0; i < CONFIG_FT_ADDR_NR; i++) { if (ft->fl_list[i].uaddr == uaddr) { @@ -198,7 +197,7 @@ static futex_lock_t *futex_set_addr(futex_t *ft, void *uaddr, thread_t *hd) } static futex_lock_t *futex_find(futex_t *fst, void *uaddr) { - for (int i = 0; i < FT_ADDR_NR; i++) + for (int i = 0; i < CONFIG_FT_ADDR_NR; i++) { if (fst->fl_list[i].uaddr == uaddr) { @@ -474,7 +473,7 @@ static void futex_unmap(obj_space_t *obj_space, kobject_t *kobj) printk("%s:%d\n", __func__, __LINE__); umword_t status = spinlock_lock(&futex->kobj.lock); - for (int i = 0; i < FT_ADDR_NR; i++) + for (int i = 0; i < CONFIG_FT_ADDR_NR; i++) { thread_t *pos; @@ -512,7 +511,7 @@ static void futex_release_stage2(kobject_t *kobj) static void futex_init(futex_t *ft) { kobject_init(&ft->kobj, FUTEX_TYPE); - for (int i = 0; i < FT_ADDR_NR; i++) + for (int i = 0; i < CONFIG_FT_ADDR_NR; i++) { slist_init(&ft->fl_list[i].thread_list_head); } diff --git a/mkrtos_knl/knl/irq.c b/mkrtos_knl/knl/irq.c index dacb35e46..229caa885 100755 --- a/mkrtos_knl/knl/irq.c +++ b/mkrtos_knl/knl/irq.c @@ -19,7 +19,7 @@ #include #include /*TODO:换成更节省内存的方式*/ -static irq_entry_t irqs[IRQ_REG_TAB_SIZE] = {0}; +static irq_entry_t irqs[CONFIG_IRQ_REG_TAB_SIZE] = {0}; static void irq_tigger(irq_entry_t *irq); /** @@ -30,7 +30,7 @@ static void irq_tigger(irq_entry_t *irq); */ bool_t irq_check_usability(int inx) { - if (inx >= IRQ_REG_TAB_SIZE) + if (inx >= CONFIG_IRQ_REG_TAB_SIZE) { return FALSE; } @@ -61,7 +61,7 @@ bool_t irq_alloc(int inx, irq_sender_t *irq, void (*irq_tigger_func)(irq_entry_t */ void irq_free(int inx) { - assert(inx < IRQ_REG_TAB_SIZE); + assert(inx < CONFIG_IRQ_REG_TAB_SIZE); irqs[inx].irq_tigger_func = NULL; } /** @@ -72,7 +72,7 @@ void irq_free(int inx) */ irq_entry_t *irq_get(int inx) { - assert(inx < IRQ_REG_TAB_SIZE); + assert(inx < CONFIG_IRQ_REG_TAB_SIZE); return &irqs[inx]; } /** @@ -83,7 +83,7 @@ void entry_handler(void) { umword_t isr_no = arch_get_isr_no(); - isr_no -= USER_ISR_START_NO; //!< 系统用的irq偏移 + isr_no -= CONFIG_USER_ISR_START_NO; //!< 系统用的irq偏移 // printk("%d.\n", isr_no); if (!irq_check_usability(isr_no)) diff --git a/mkrtos_knl/knl/mm_space.c b/mkrtos_knl/knl/mm_space.c index 5341dc7e1..ce2c5aac1 100644 --- a/mkrtos_knl/knl/mm_space.c +++ b/mkrtos_knl/knl/mm_space.c @@ -18,7 +18,7 @@ void mm_space_init(mm_space_t *mm_space, int is_knl) { region_info_t *regi_info; - for (int i = 0; i < REGION_NUM; i++) + for (int i = 0; i < CONFIG_REGION_NUM; i++) { mm_space->pt_regions[i].region_inx = -1; } diff --git a/mkrtos_knl/knl/obj_space.c b/mkrtos_knl/knl/obj_space.c index 0dce532a9..fcb594b6c 100755 --- a/mkrtos_knl/knl/obj_space.c +++ b/mkrtos_knl/knl/obj_space.c @@ -14,14 +14,14 @@ #include "string.h" void obj_space_init(obj_space_t *obj_space, ram_limit_t *ram) { - for (int i = 0; i < OBJ_MAP_TAB_SIZE; i++) + for (int i = 0; i < CONFIG_OBJ_MAP_TAB_SIZE; i++) { obj_space->tab.tabs[i] = NULL; } } void obj_space_release(obj_space_t *obj_space, ram_limit_t *ram) { - for (int i = 0; i < OBJ_MAP_TAB_SIZE; i++) + for (int i = 0; i < CONFIG_OBJ_MAP_TAB_SIZE; i++) { mm_limit_free(ram, obj_space->tab.tabs[i]); } @@ -33,8 +33,8 @@ void obj_space_del(obj_space_t *obj_space, obj_addr_t inx) { return; } - int tab_inx = inx / OBJ_MAP_ENTRY_SIZE; - int entry_inx = inx % OBJ_MAP_ENTRY_SIZE; + int tab_inx = inx / CONFIG_OBJ_MAP_ENTRY_SIZE; + int entry_inx = inx % CONFIG_OBJ_MAP_ENTRY_SIZE; if (!obj_space->tab.tabs[tab_inx]) { @@ -50,8 +50,8 @@ obj_map_entry_t *obj_space_insert(obj_space_t *obj_space, ram_limit_t *ram, kobj { return NULL; } - int tab_inx = inx / OBJ_MAP_ENTRY_SIZE; - int entry_inx = inx % OBJ_MAP_ENTRY_SIZE; + int tab_inx = inx / CONFIG_OBJ_MAP_ENTRY_SIZE; + int entry_inx = inx % CONFIG_OBJ_MAP_ENTRY_SIZE; if (!obj_space->tab.tabs[tab_inx]) { @@ -79,8 +79,8 @@ obj_map_entry_t *obj_space_lookup(obj_space_t *obj_space, obj_addr_t inx) { return NULL; } - int tab_inx = inx / OBJ_MAP_ENTRY_SIZE; - int entry_inx = inx % OBJ_MAP_ENTRY_SIZE; + int tab_inx = inx / CONFIG_OBJ_MAP_ENTRY_SIZE; + int entry_inx = inx % CONFIG_OBJ_MAP_ENTRY_SIZE; if (!obj_space->tab.tabs[tab_inx]) { diff --git a/mkrtos_knl/knl/printk.c b/mkrtos_knl/knl/printk.c index 0af0ee4b5..4e0714207 100755 --- a/mkrtos_knl/knl/printk.c +++ b/mkrtos_knl/knl/printk.c @@ -15,7 +15,7 @@ #include "uart/uart.h" static spinlock_t lock; -static char print_cache[128]; +static char print_cache[CONFIG_PRINTK_CACHE_SIZE]; /** * @brief 原始输出 diff --git a/mkrtos_script/build.sh b/mkrtos_script/build.sh index f079364a1..0803003d9 100755 --- a/mkrtos_script/build.sh +++ b/mkrtos_script/build.sh @@ -1,9 +1,9 @@ #!/bin/bash -# export TOOLCHAIN=/home/zhangzheng/gcc-arm-none-eabi-5_4-2016q3/bin/ -# export TOOLCHAIN_LIB=/home/zhangzheng/gcc-arm-none-eabi-5_4-2016q3/lib/gcc/arm-none-eabi/5.4.1/armv7-m -export TOOLCHAIN=/Users/zhangzheng/gcc-arm-none-eabi-10.3-2021.10/bin/ -export TOOLCHAIN_LIB=/Users/zhangzheng/gcc-arm-none-eabi-10.3-2021.10/lib/gcc/arm-none-eabi/10.3.1/thumb/v7-m/nofp +export TOOLCHAIN=/home/zhangzheng/gcc-arm-none-eabi-5_4-2016q3/bin/ +export TOOLCHAIN_LIB=/home/zhangzheng/gcc-arm-none-eabi-5_4-2016q3/lib/gcc/arm-none-eabi/5.4.1/armv7-m +# export TOOLCHAIN=/Users/zhangzheng/gcc-arm-none-eabi-10.3-2021.10/bin/ +# export TOOLCHAIN_LIB=/Users/zhangzheng/gcc-arm-none-eabi-10.3-2021.10/lib/gcc/arm-none-eabi/10.3.1/thumb/v7-m/nofp export KEN_OFFSET=0x2000 export INIT_OFFSET=0x10000 export BOOTFS_ADDR_OFFSET=0x20000 diff --git a/mkrtos_user/lib/libc_backend/src/fd_map.c b/mkrtos_user/lib/libc_backend/src/fd_map.c index 091289d80..d7f48358b 100644 --- a/mkrtos_user/lib/libc_backend/src/fd_map.c +++ b/mkrtos_user/lib/libc_backend/src/fd_map.c @@ -7,19 +7,19 @@ #include #include -#define FD_MAP_ROW_CN 16 -#define FD_MAP_ROW_NR 16 +#define CONFIG_FD_MAP_ROW_CN 16 +#define CONFIG_FD_MAP_ROW_NR 16 -#define FD_MAP_TOTAL (FD_MAP_ROW_CN * FD_MAP_ROW_NR) +#define FD_MAP_TOTAL (CONFIG_FD_MAP_ROW_CN * CONFIG_FD_MAP_ROW_NR) typedef struct fd_map_row { - fd_map_entry_t entry[FD_MAP_ROW_CN]; + fd_map_entry_t entry[CONFIG_FD_MAP_ROW_CN]; } fd_map_row_t; typedef struct fd_map { - fd_map_row_t *row[FD_MAP_ROW_NR]; + fd_map_row_t *row[CONFIG_FD_MAP_ROW_NR]; pthread_spinlock_t lock; uint16_t free_fd; } fd_map_t; @@ -35,13 +35,13 @@ again_alloc: if (fd_map.free_fd >= FD_MAP_TOTAL) { // 没有可用的fd了,尝试循环查找 - for (int i = 0; i < FD_MAP_ROW_NR; i++) + for (int i = 0; i < CONFIG_FD_MAP_ROW_NR; i++) { - for (int j = 0; j < FD_MAP_ROW_CN; j++) + for (int j = 0; j < CONFIG_FD_MAP_ROW_CN; j++) { if (fd_map.row[i]->entry[j].flags == 0) { - alloc_fd = i * FD_MAP_ROW_CN + j; + alloc_fd = i * CONFIG_FD_MAP_ROW_CN + j; goto next; } } @@ -55,10 +55,10 @@ again_alloc: alloc_fd = fd_map.free_fd; } next:; - int row_inx = alloc_fd / FD_MAP_ROW_CN; - int inx = alloc_fd % FD_MAP_ROW_CN; + int row_inx = alloc_fd / CONFIG_FD_MAP_ROW_CN; + int inx = alloc_fd % CONFIG_FD_MAP_ROW_CN; - assert(row_inx < FD_MAP_ROW_NR); + assert(row_inx < CONFIG_FD_MAP_ROW_NR); if (fd_map.row[row_inx] == NULL) { fd_map.row[row_inx] = malloc(sizeof(fd_map_row_t)); @@ -86,8 +86,8 @@ int fd_map_get(int fd, fd_map_entry_t *new_entry) { return -1; } - int row_inx = fd / FD_MAP_ROW_CN; - int inx = fd % FD_MAP_ROW_CN; + int row_inx = fd / CONFIG_FD_MAP_ROW_CN; + int inx = fd % CONFIG_FD_MAP_ROW_CN; *new_entry = fd_map.row[row_inx]->entry[inx]; return 0; @@ -98,8 +98,8 @@ int fd_map_update(int fd, fd_map_entry_t *new_entry) { return -1; } - int row_inx = fd / FD_MAP_ROW_CN; - int inx = fd % FD_MAP_ROW_CN; + int row_inx = fd / CONFIG_FD_MAP_ROW_CN; + int inx = fd % CONFIG_FD_MAP_ROW_CN; pthread_spin_lock(&fd_map.lock); int flags = fd_map.row[row_inx]->entry[inx].flags; @@ -115,8 +115,8 @@ int fd_map_free(int fd, fd_map_entry_t *ret_entry) { return -1; } - int row_inx = fd / FD_MAP_ROW_CN; - int inx = fd % FD_MAP_ROW_CN; + int row_inx = fd / CONFIG_FD_MAP_ROW_CN; + int inx = fd % CONFIG_FD_MAP_ROW_CN; pthread_spin_lock(&fd_map.lock); if (fd_map.row[row_inx]->entry[inx].flags == 1) diff --git a/mkrtos_user/lib/sys/inc/u_arch.h b/mkrtos_user/lib/sys/inc/u_arch.h index bb99de60f..829a6a8a9 100644 --- a/mkrtos_user/lib/sys/inc/u_arch.h +++ b/mkrtos_user/lib/sys/inc/u_arch.h @@ -1,6 +1,6 @@ #pragma once #include "u_types.h" -#define SYS_SCHE_HZ 1000 //!< 系统调度频率 +// #define CONFIG_SYS_SCHE_HZ 1000 //!< 系统调度频率 #define MK_PAGE_SIZE 512 #define WORD_BYTES (sizeof(void *)) diff --git a/mkrtos_user/lib/sys_util/src/u_sleep.c b/mkrtos_user/lib/sys_util/src/u_sleep.c index 38506257d..2dbfda421 100644 --- a/mkrtos_user/lib/sys_util/src/u_sleep.c +++ b/mkrtos_user/lib/sys_util/src/u_sleep.c @@ -12,5 +12,5 @@ static obj_handler_t hd = HANDLER_INVALID; void u_sleep_ms(size_t ms) { - thread_ipc_wait(ipc_timeout_create2(0, ms / (1000 / SYS_SCHE_HZ)), NULL); + thread_ipc_wait(ipc_timeout_create2(0, ms / (1000 / CONFIG_SYS_SCHE_HZ)), NULL); } diff --git a/mkrtos_user/server/drv/rtthread_drv/bsp/stm32/libraries/HAL_Drivers/CMakeLists.txt b/mkrtos_user/server/drv/rtthread_drv/bsp/stm32/libraries/HAL_Drivers/CMakeLists.txt index a8371d25b..3801c8c8b 100644 --- a/mkrtos_user/server/drv/rtthread_drv/bsp/stm32/libraries/HAL_Drivers/CMakeLists.txt +++ b/mkrtos_user/server/drv/rtthread_drv/bsp/stm32/libraries/HAL_Drivers/CMakeLists.txt @@ -40,8 +40,6 @@ if(NOT DEFINED RT_USING_SPI_BITOPS) list(REMOVE_ITEM deps ${CMAKE_CURRENT_LIST_DIR}/drv_soft_spi.c) endif() -message("========"${deps}) - add_library( hal_drviers STATIC diff --git a/mkrtos_user/server/init/src/cons.c b/mkrtos_user/server/init/src/cons.c index c6ae6fa77..5cee2cf4e 100644 --- a/mkrtos_user/server/init/src/cons.c +++ b/mkrtos_user/server/init/src/cons.c @@ -49,7 +49,7 @@ void console_init(void) cons_svr_obj_init(&cons_obj); meta_reg_svr_obj(&cons_obj.svr, CONS_PROT); u_thread_create(&cons_th, cons_stack, sizeof(cons_stack), NULL, console_read_func); - u_thread_run(cons_th, 2); + u_thread_run(cons_th, 3); printf("cons svr init...\n"); } /** diff --git a/setting.cmake b/setting.cmake index 7a36a30f9..7875f371c 100755 --- a/setting.cmake +++ b/setting.cmake @@ -25,6 +25,7 @@ set(CMAKE_C_FLAGS "-mcpu=${MKRTOS_ARCH} -mthumb -O0 -g3 -lc -lrdimon -msoft-floa -std=gnu11 -ffunction-sections -fdata-sections -fno-builtin -mfix-cortex-m3-ldrd \ -nostartfiles -nodefaultlibs -nostdlib -nostdinc -Xlinker \ -fno-stack-protector -Wl,--gc-sections \ + -include ${CMAKE_SOURCE_DIR}/build/autoconf.h \ " CACHE STRING "" FORCE) set(CMAKE_CXX_FLAGS "-mcpu=${MKRTOS_ARCH} -mthumb -mno-thumb-interwork -D=MKRTOS \ @@ -32,11 +33,13 @@ set(CMAKE_CXX_FLAGS "-mcpu=${MKRTOS_ARCH} -mthumb -mno-thumb-interwork -D=MKRTOS -fmessage-length=0 -Xlinker --print-map -Wall -W -fno-stack-protector -g \ -mfloat-abi=soft -lc -lrdimon -u _printf_float \ -ffunction-sections -fdata-sections -fno-builtin -nostartfiles -nodefaultlibs -nostdlib -nostdinc -Xlinker \ +-include ${CMAKE_SOURCE_DIR}/build/autoconf.h \ " CACHE STRING "" FORCE) set(CMAKE_ASM_FLAGS "-mcpu=${MKRTOS_ARCH} -mthumb -Os -g3 -mfloat-abi=soft -lc -lrdimon -D=MKRTOS \ -u _printf_float -std=gnu11 -ffunction-sections -fdata-sections -fno-builtin \ -nostartfiles -nodefaultlibs -nostdlib -nostdinc -Xlinker -fno-stack-protector \ +-include ${CMAKE_SOURCE_DIR}/build/autoconf.h \ " CACHE STRING "" FORCE) set(BOARD_NAME "$ENV{BOARD}")