190 lines
		
	
	
		
			7.0 KiB
		
	
	
	
		
			Groovy
		
	
	
	
	
	
			
		
		
	
	
			190 lines
		
	
	
		
			7.0 KiB
		
	
	
	
		
			Groovy
		
	
	
	
	
	
| void checkout_project() {
 | |
|     checkout([
 | |
|         $class: 'GitSCM',
 | |
|         branches: [
 | |
|             [name: '*/develop']
 | |
|         ],
 | |
|         extensions: [
 | |
|             [$class: 'CleanBeforeCheckout'],
 | |
|             [$class: 'SubmoduleOption', disableSubmodules: false, parentCredentials: true, recursiveSubmodules: true, reference: '', trackingSubmodules: false]
 | |
|         ],
 | |
|         submoduleCfg: [],
 | |
|         userRemoteConfigs: [
 | |
|             [credentialsId: 'gitea-jenkins', url: 'https://git.minres.com/Firmware/Firmwares.git']
 | |
|         ]
 | |
|     ])
 | |
| }
 | |
| 
 | |
| 
 | |
| void checkout_iss_project(String repoUrl, String branch = 'develop') {
 | |
|     checkout([
 | |
|         $class: 'GitSCM',
 | |
|         branches: [
 | |
|             [name: "*/${branch}"]
 | |
|         ],
 | |
|         extensions: [
 | |
|             [$class: 'CleanBeforeCheckout'],
 | |
|             [$class: 'SubmoduleOption', disableSubmodules: false, parentCredentials: true, recursiveSubmodules: true, reference: '', trackingSubmodules: false, shallow: true]
 | |
|         ],
 | |
|         submoduleCfg: [],
 | |
|         userRemoteConfigs: [
 | |
|             [credentialsId: 'gitea-jenkins', url: repoUrl]
 | |
|         ]
 | |
|     ])
 | |
| }
 | |
| 
 | |
| void checkout_develop() {
 | |
|     dir("bare-metal-bsp") {
 | |
|         withCredentials([usernamePassword(credentialsId: 'gitea-jenkins', usernameVariable: 'GIT_USERNAME', passwordVariable: 'GIT_PASSWORD')]) {
 | |
|             sh ("git pull origin develop")
 | |
|         }
 | |
|     }
 | |
|     //sh("cd bare-metal-bsp && git checkout develop")
 | |
| }
 | |
| 
 | |
| void make_hello(board) {
 | |
|     sh("make -C hello-world/ BOARD=${board}")
 | |
|     sh("make -C hello-world/ clean")
 | |
| }
 | |
| 
 | |
| void cmake_hello(board,build_type,core_type) {  
 | |
|     def flavor ="${board}_${build_type}_${core_type}"
 | |
|     if (core_type=="32")
 | |
|         flavor ="${board}_${build_type}"
 | |
|     sh("cmake -B ${flavor}  --preset=${flavor}") 
 | |
|     sh("cmake --build ${flavor}")    
 | |
| }
 | |
| 
 | |
| pipeline {
 | |
|     agent { docker { 
 | |
|         image 'ubuntu-riscv'
 | |
|         args '-v $HOME/.m2:/root/.m2'
 | |
|     }}
 | |
|     options {
 | |
|         // using the Timestamper plugin we can add timestamps to the console log
 | |
|         timestamps()
 | |
|         skipStagesAfterUnstable()
 | |
|     }
 | |
|     stages {
 | |
|         /*stage('checkout repo') { steps{ checkout_project()}}
 | |
|         stage('checkout develop') { steps{ checkout_develop()}}
 | |
|         stage('make iss') {steps { make_hello("iss")}}
 | |
|         stage('make hifive1') {steps { make_hello("hifive1")}}
 | |
|         stage('make TGC5L') {steps { make_hello("TGC5L")}}
 | |
|         stage('make rtl') {steps { make_hello("rtl")}}
 | |
|         stage('make ehrenberg') {steps { make_hello("ehrenberg")}}
 | |
|         stage('make tgc_vp') {steps { make_hello("tgc_vp")}}*/
 | |
|         
 | |
|         stage('make hello-world') {
 | |
|             matrix {
 | |
|                 axes {
 | |
|                     axis{
 | |
|                         name 'BOARD'
 | |
|                         values 'iss',  'moonlight',  'tgc_vp'
 | |
|                     }
 | |
|                 }
 | |
|                 stages {
 | |
|                     stage('Force sequential') {
 | |
|                         options {
 | |
|                             lock("One Board at a time")
 | |
|                         }
 | |
|                         stages {
 | |
|                             stage("make") {
 | |
|                                 steps {
 | |
|                                     make_hello("${BOARD}")
 | |
|                                 }
 | |
|                             }
 | |
|                         }
 | |
|                     }
 | |
|                 }
 | |
|             } 
 | |
|         }
 | |
|         
 | |
|         stage('CMAKE flow for hello-world') {
 | |
|             matrix {
 | |
|                 axes {
 | |
|                     axis{
 | |
|                         name 'BOARD'
 | |
|                         values 'ISS',  'Moonlight', 'TGC_VP'
 | |
|                     }
 | |
|                     axis{
 | |
|                         name 'BUILD_TYPE'
 | |
|                         values 'Debug',  'Release'
 | |
|                     }
 | |
|                     axis{
 | |
|                         name 'CORE_TYPE'
 | |
|                         values '32',  '64'
 | |
|                     }
 | |
|                 }
 | |
|                 stages {
 | |
|                     stage('Force sequential') {
 | |
|                         options {
 | |
|                             lock("One Board at a time")
 | |
|                         }
 | |
|                         when{
 | |
|                             not {
 | |
|                                 anyOf {
 | |
|                                     expression { BOARD == 'Moonlight' && CORE_TYPE =='64'}
 | |
|                                     expression { BOARD == 'TGC_VP' && CORE_TYPE =='64'}
 | |
|                                 }                                
 | |
|                             }
 | |
|                         }
 | |
|                         stages {
 | |
|                             stage("CMAKE") {
 | |
|                                 steps {
 | |
|                                     dir("hello-world"){
 | |
|                                         cmake_hello("${BOARD}","${BUILD_TYPE}","${CORE_TYPE}")
 | |
|                                     }
 | |
|                                 }
 | |
|                             }
 | |
|                         }
 | |
|                     }
 | |
|                 }
 | |
|             } 
 | |
|         }
 | |
|         stage("Checkout TGC-ISS, TGC-Compliance and TGC-GEN"){
 | |
|             steps {                                       
 | |
|                 dir("TGC-ISS"){                    
 | |
|                     sh 'rm -rf * .??* '
 | |
|                     checkout_iss_project("https://git.minres.com/TGFS/TGC-ISS.git", "develop")
 | |
|                     dir("TGC-COMPLIANCE"){                        
 | |
|                         checkout_iss_project("https://git.minres.com/TGFS/TGC-COMPLIANCE.git", "master")
 | |
|                     }
 | |
|                     dir("TGC-GEN"){                        
 | |
|                         checkout_iss_project("https://git.minres.com/TGFS/TGC-GEN.git", "develop")
 | |
|                         }                            
 | |
|                     } 
 | |
|                 }
 | |
|         }
 | |
|         stage("Generate cores and build TGC-ISS"){
 | |
|             steps {                
 | |
|                 sh 'rm -rf *@tmp'                     
 | |
|                 sh '''
 | |
|                 for core in RV32GC; do 
 | |
|                     for backend in interp; do 
 | |
|                             TGC-ISS/TGC-GEN/scripts/generate_iss.sh -o TGC-ISS/dbt-rise-tgc/ -c $core -b ${backend} TGC-ISS/TGC-GEN/CoreDSL/${core}.core_desc
 | |
|                     done
 | |
|                 done
 | |
|                 for core in RV64GC; do
 | |
|                     for backend in interp; do 
 | |
|                         TGC-ISS/TGC-GEN/scripts/generate_iss.sh -o TGC-ISS/dbt-rise-tgc/ -c $core -b ${backend} TGC-ISS/TGC-GEN/CoreDSL/${core}.core_desc
 | |
|                     done
 | |
|                 done
 | |
|                 '''
 | |
|                 sh 'conan profile detect --force'
 | |
|                 sh 'rm -rf TGC-ISS/build'
 | |
|                 sh 'cmake -S TGC-ISS/. -B TGC-ISS/build --preset Release -DWITH_ASMJIT=ON -DWITH_TCC=ON -DWITH_LLVM=OFF'                
 | |
|                 sh 'cmake --build TGC-ISS/build -j'
 | |
|                 sh 'TGC-ISS/build/dbt-rise-tgc/tgc-sim --isa ?'                       
 | |
|                 }
 | |
|         }
 | |
| 
 | |
|         stage("start to run hello FW on ISS") {
 | |
|             steps {                
 | |
|                 sh 'TGC-ISS/build/dbt-rise-tgc/tgc-sim -f hello-world/ISS_Debug/hello.elf'
 | |
|                 sh 'TGC-ISS/build/dbt-rise-tgc/tgc-sim -f hello-world/ISS_Debug_64/hello.elf --isa=rv64gc'                
 | |
|             }
 | |
|         }
 | |
|     }    
 | |
| }
 |