-
Notifications
You must be signed in to change notification settings - Fork 37
Figure out CPU by MCU provided #50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,6 +43,27 @@ package body Descriptors.Device is | |
| Output_Dir : String); | ||
| -- Dump the IRQ names and trap handlers | ||
|
|
||
| ----------------- | ||
| -- MCU_To_CPU -- | ||
| ----------------- | ||
|
|
||
| function MCU_To_CPU | ||
| (Device : Device_T) return Unbounded_String | ||
| is | ||
| Descrition_String : constant String := To_String (Device.Short_Desc); | ||
| CPU : Unbounded_String; | ||
| begin | ||
| if Starts_With (S1 => Descrition_String, S2 => "STM32F0") then | ||
|
||
| CPU := To_Unbounded_String ("cortex-m0"); | ||
| elsif Starts_With (S1 => Descrition_String, S2 => "Cortex-M1") then | ||
| CPU := To_Unbounded_String ("cortex-m1"); | ||
| else | ||
| CPU := To_Unbounded_String ("cortex-m4"); | ||
| end if; | ||
|
|
||
| return CPU; | ||
| end MCU_To_CPU; | ||
|
|
||
| ----------------- | ||
| -- Read_Device -- | ||
| ----------------- | ||
|
|
@@ -209,7 +230,8 @@ package body Descriptors.Device is | |
| New_Line (ASM); | ||
| Put_Line (ASM, ASCII.HT & ".syntax unified"); | ||
| -- ??? target is m4/m7, but what about previous versions? | ||
| Put_Line (ASM, ASCII.HT & ".cpu cortex-m4"); | ||
| Put_Line (ASM, ASCII.HT & ".cpu " & | ||
| To_String (MCU_To_CPU (Device => Device))); | ||
| Put_Line (ASM, ASCII.HT & ".thumb"); | ||
| New_Line (ASM); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You would need to declare the function first, at the beginning of the package. I'm a bit surprised this didn't raise a compilation error. I'll check the project file to make sure this rule is checked by gnat.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can put in place an automatic validation of the pull request with Travis-CI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Also can confirm that the project builds and executes successfully even without the declaration.