Skip to content

Commit

Permalink
build option for CortexM4 or M7
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikaël BRIDAY committed Feb 15, 2024
1 parent 80f417e commit 9c9fea4
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 19 deletions.
4 changes: 2 additions & 2 deletions goil/templates/build/build_py.goilTemplate
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ if exists POSTBUILD then
let postgoals := mapof exists POSTBUILD default ( @() ) by NAME
end if

%#! /usr/bin/env python
%#! /usr/bin/env python3
# -*- coding: UTF-8 -*-
#----------------------------------------------------------------------
#--- Python Build file for application % !CPUNAME %
Expand All @@ -61,7 +61,7 @@ end if
#--- build.py is generated each time goil is called by make.py
#----------------------------------------------------------------------

import sys, os, subprocess, string, distutils.spawn
import sys, os, subprocess, string
from string import Template

#--- Add some function for Python3 support
Expand Down
12 changes: 6 additions & 6 deletions goil/templates/build/make_py.goilTemplate
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ foreach pb in exists POSTBUILD default( @() ) do
end foreach
end foreach

%#! /usr/bin/env python
%#! /usr/bin/env python3
# -*- coding: UTF-8 -*-
#----------------------------------------------------------------------
#--- Python Make file for application % !CPUNAME %
Expand Down Expand Up @@ -179,11 +179,11 @@ os.chdir (scriptDir)

#--- Launch build.py
# is there the 'python' executable?
import distutils.spawn
if distutils.spawn.find_executable("python"):
childProcess = subprocess.Popen (["python", "build.py", askedGoal, str(maxParallelJobs)])
else: #no python executable, maybe python3
childProcess = subprocess.Popen (["python3", "build.py", askedGoal, str(maxParallelJobs)])
import shutil
cmd = shutil.which('python')
if not cmd:
cmd = shutil.which('python3')
childProcess = subprocess.Popen ([cmd, "build.py", askedGoal, str(maxParallelJobs)])

#--- Wait for subprocess termination
if childProcess.poll () == None :
Expand Down
16 changes: 5 additions & 11 deletions goil/templates/config/cortex-m/armv7em/buildOptions.oil
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ CPU buildOptions {
//COMMONFLAGS = "-Wall";
COMMONFLAGS = "-Wno-unused-but-set-variable"; // Except unused variables
COMMONFLAGS = "-Wmissing-field-initializers"; // Struct initialized with incorrect number of fiels
COMMONFLAGS = "-mcpu=cortex-m4"; // Compile for cortex-m4
COMMONFLAGS = "-mthumb"; // Thumb instruction set
COMMONFLAGS = "-mfloat-abi=soft"; // Floating point numbers are computed in software
COMMONFLAGS = "-mfpu=fpv4-sp-d16"; // Truly obscure option to set. Check http://stackoverflow.com/questions/19464556/how-to-link-gcc-options-to-the-arm-mcu-fpu-datasheet
COMMONFLAGS = "-nostartfiles"; // Default startfiles (crt0.c) are not used
COMMONFLAGS = "-fno-builtin"; // Do not used built in gcc functions
CFLAGS = "--specs=nosys.specs"; //
Expand All @@ -41,18 +37,16 @@ CPU buildOptions {
*/
ASFLAGS = "-g"; // Produce debugging information
ASFLAGS = "-Wall"; // All warnings on
ASFLAGS = "-mcpu=cortex-m4"; // Assemble for cortex-m4
ASFLAGS = "-mthumb"; // Thumb instruction set
ASFLAGS = "--fatal-warnings"; // A warning is an error
ASFLAGS = "-mfloat-abi=soft"; // Floating point numbers are computed in software
ASFLAGS = "-mfpu=fpv4-sp-d16"; // Truly obscure option to set.
// Check http://stackoverflow.com/questions/19464556/how-to-link-gcc-options-to-the-arm-mcu-fpu-datasheet



// LDFLAGS = "--no-warn-rwx-segment"; // fix gnu-ld 2.39 snafu
LDFLAGS = "--fatal-warnings"; // A warning is an error
LDFLAGS = "--warn-common"; // Warn when a common symbol is combined with another common symbol
LDFLAGS = "--no-undefined"; // Report unresolved symbol references
LDFLAGS = "--gc-sections"; // Remove unused sections. Works with -ffunction-sections and -fdata-sections, see above
};
};

//one should include target specific flags for CortexM4 or CortexM7
#includeifexists <buildOptionsTarget.oil>

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
rm /*
* ARMv7 build options for gcc - CortexM4
* TODO: we use only soft FPU for now!
*/
CPU buildOptions {
BUILDOPTIONS buildForCortexM4 {
COMMONFLAGS = "-mcpu=cortex-m4"; // Compile for cortex-m4
COMMONFLAGS = "-mthumb"; // Thumb instruction set
COMMONFLAGS = "-mfloat-abi=soft"; // Floating point numbers are computed in software
COMMONFLAGS = "-mfpu=fpv4-sp-d16"; // FPU version for CortexM4

ASFLAGS = "-mcpu=cortex-m4"; // Assemble for cortex-m4
ASFLAGS = "-mthumb"; // Thumb instruction set
ASFLAGS = "-mfloat-abi=soft"; // Floating point numbers are computed in software
ASFLAGS = "-mfpu=fpv4-sp-d16"; // FPU version for CortexM4
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
rm /*
* ARMv7 build options for gcc - CortexM4
* TODO: we use only soft FPU for now!
*/
CPU buildOptions {
BUILDOPTIONS buildForCortexM4 {
COMMONFLAGS = "-mcpu=cortex-m4"; // Compile for cortex-m4
COMMONFLAGS = "-mthumb"; // Thumb instruction set
COMMONFLAGS = "-mfloat-abi=soft"; // Floating point numbers are computed in software
COMMONFLAGS = "-mfpu=fpv4-sp-d16"; // FPU version for CortexM4

ASFLAGS = "-mcpu=cortex-m4"; // Assemble for cortex-m4
ASFLAGS = "-mthumb"; // Thumb instruction set
ASFLAGS = "-mfloat-abi=soft"; // Floating point numbers are computed in software
ASFLAGS = "-mfpu=fpv4-sp-d16"; // FPU version for CortexM4
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
rm /*
* ARMv7 build options for gcc - CortexM4
* TODO: we use only soft FPU for now!
*/
CPU buildOptions {
BUILDOPTIONS buildForCortexM4 {
COMMONFLAGS = "-mcpu=cortex-m4"; // Compile for cortex-m4
COMMONFLAGS = "-mthumb"; // Thumb instruction set
COMMONFLAGS = "-mfloat-abi=soft"; // Floating point numbers are computed in software
COMMONFLAGS = "-mfpu=fpv4-sp-d16"; // FPU version for CortexM4

ASFLAGS = "-mcpu=cortex-m4"; // Assemble for cortex-m4
ASFLAGS = "-mthumb"; // Thumb instruction set
ASFLAGS = "-mfloat-abi=soft"; // Floating point numbers are computed in software
ASFLAGS = "-mfpu=fpv4-sp-d16"; // FPU version for CortexM4
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
rm /*
* ARMv7 build options for gcc - CortexM7
* TODO: we use only soft FPU for now!
*/
CPU buildOptions {
BUILDOPTIONS buildForCortexM4 {
COMMONFLAGS = "-mcpu=cortex-m7"; // Compile for cortex-m7
COMMONFLAGS = "-mthumb"; // Thumb instruction set
COMMONFLAGS = "-mfloat-abi=soft"; // Floating point numbers are computed in software
COMMONFLAGS = "-mfpu=fpv5-d16"; // FPU version for CortexM7

ASFLAGS = "-mcpu=cortex-m7"; // Assemble for cortex-m7
ASFLAGS = "-mthumb"; // Thumb instruction set
ASFLAGS = "-mfloat-abi=soft"; // Floating point numbers are computed in software
ASFLAGS = "-mfpu=fpv5-d16"; // FPU version for CortexM7
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
rm /*
* ARMv7 build options for gcc - CortexM4
* TODO: we use only soft FPU for now!
*/
CPU buildOptions {
BUILDOPTIONS buildForCortexM4 {
COMMONFLAGS = "-mcpu=cortex-m4"; // Compile for cortex-m4
COMMONFLAGS = "-mthumb"; // Thumb instruction set
COMMONFLAGS = "-mfloat-abi=soft"; // Floating point numbers are computed in software
COMMONFLAGS = "-mfpu=fpv4-sp-d16"; // FPU version for CortexM4

ASFLAGS = "-mcpu=cortex-m4"; // Assemble for cortex-m4
ASFLAGS = "-mthumb"; // Thumb instruction set
ASFLAGS = "-mfloat-abi=soft"; // Floating point numbers are computed in software
ASFLAGS = "-mfpu=fpv4-sp-d16"; // FPU version for CortexM4
};
};

0 comments on commit 9c9fea4

Please sign in to comment.