Skip to content

Commit

Permalink
Remove invalid assertion from stm32f4 runtime setup
Browse files Browse the repository at this point in the history
Remove an assertion from setup_pll.adb in the stm32f4 runtimes. That
assertion introduces a dependency to System.Assertions which does not
conform to the pragma No_Elaboration_Code_All required by setup_pll.ads.

Also fix the check itself. The assertion was inverted, so it would
always fail on successful execution.

ref eng/toolchain/bb-runtimes#85
  • Loading branch information
jklmnn committed Oct 21, 2024
1 parent c944d7d commit fdbfc9d
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions arm/stm32/setup_pll.adb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ with System.BB.Parameters; use System.BB.Parameters;
with System.BB.MCU_Parameters;
with System.BB.Board_Parameters; use System.BB.Board_Parameters;
with System.STM32; use System.STM32;
with System.Machine_Reset;

procedure Setup_Pll is
procedure Initialize_Clocks;
Expand Down Expand Up @@ -157,11 +158,15 @@ procedure Setup_Pll is
"Cannot generate requested clock");

-- Cannot be checked at compile time, depends on APB1_PRE and APB2_PRE
pragma Assert
(HCLK not in HCLK_Range
or else PCLK1 not in PCLK1_Range
or else PCLK2 not in PCLK2_Range,
"Invalid AHB/APB prescalers configuration");
if HCLK not in HCLK_Range
or else PCLK1 not in PCLK1_Range
or else PCLK2 not in PCLK2_Range
then
-- Invalid AHB/APB prescalers configuration.
-- We cannot raise an exception here as the runtime is not fully
-- initialized yet.
System.Machine_Reset.Stop;
end if;

-- PWR clock enable

Expand Down

0 comments on commit fdbfc9d

Please sign in to comment.