Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 

50 wiersze
1.7 KiB

  1. $projectRoot = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
  2. $mainSource = Get-Content -Raw (Join-Path $projectRoot 'Core/Src/main.c')
  3. $interruptSource = Get-Content -Raw (Join-Path $projectRoot 'Core/Src/stm32f4xx_it.c')
  4. function Require-SourcePattern
  5. {
  6. param(
  7. [string]$Source,
  8. [string]$Pattern,
  9. [string]$Message
  10. )
  11. if ($Source -notmatch $Pattern)
  12. {
  13. throw $Message
  14. }
  15. }
  16. Require-SourcePattern $mainSource `
  17. 'HAL_NVIC_SetPriority\(SysTick_IRQn, CPU_CFG_KA_IPL_BOUNDARY, 0U\)' `
  18. 'SysTick priority must use CPU_CFG_KA_IPL_BOUNDARY.'
  19. Require-SourcePattern $interruptSource 'OS_CPU_SysTickHandler\(\)' `
  20. 'SysTick must use the uC/OS-II port wrapper.'
  21. Require-SourcePattern $mainSource `
  22. 'static HAL_StatusTypeDef AppRecoverUartReception\(void\)' `
  23. 'UART recovery helper is missing.'
  24. Require-SourcePattern $mainSource 'ModbusReceptionNeedsRecovery' `
  25. 'UART pending-recovery state is missing.'
  26. $sysTickHandler = [regex]::Match(
  27. $interruptSource,
  28. 'void SysTick_Handler\(void\)\s*\{(?s:.*?)\n\}\s*/\*\*').Value
  29. if (($sysTickHandler -match 'OSIntEnter\(\)') `
  30. -or ($sysTickHandler -match 'OSTimeTick\(\)') `
  31. -or ($sysTickHandler -match 'OSIntExit\(\)'))
  32. {
  33. throw 'SysTick must not contain a handwritten uC/OS-II tick sequence.'
  34. }
  35. $uartErrorCallback = [regex]::Match(
  36. $mainSource,
  37. 'void HAL_UART_ErrorCallback\(UART_HandleTypeDef \*uartHandle\)\s*\{(?s:.*?)\n\}\s*/\*\*').Value
  38. if (($uartErrorCallback -match 'HAL_UART_Receive_IT') `
  39. -or ($uartErrorCallback -match 'HAL_UART_AbortReceive_IT'))
  40. {
  41. throw 'UART error callback must defer recovery to the Modbus task.'
  42. }
  43. Write-Output 'RTU runtime invariants are present.'