This is the mail archive of the ecos-patches@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug 1001607] Cortex-M4F architectural Floating Point Support


Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001607

--- Comment #18 from Ilija Kocho <ilijak@siva.com.mk> 2012-08-08 17:48:56 BST ---
Hi Jifl

(In reply to comment #16)
> Hi Ilija,
> 
[snip]

> I also had a go at trying to work around the issues with simpler CDL, and I
> think we could do something with a CYGBLD_ARCH_XFLAGS option which would be set
> by the architecture HAL, and would be explicitly placed in CYGBLD_GLOBAL_CFLAGS
> in each platform HAL instead of the platform HAL putting in its own -mcpu=...
> etc. flags.
> 

[snip]

> 
> So I think I'm now increasingly of the opinion that we should just drop all the
> CYGOPT_HAL_CORTEXM4_CODE and assorted complexity entirely. And essentially
> assume the new tools are available.
> 
> It's also true that it would be good for the CDL to be checking that the
> compile flags match the CDL (i.e. Cortex-M4 in the CDL means -mcpu=cortex-m4
> and so on).  So rather than having a temporary change which involves many extra
> CDL options, the part we are making temporary is the bit that says:
> requires { ("CYGHWR_HAL_CORTEXM == "M4") implies
>   is_substr(!is_substr(CYGBLD_GLOBAL_CFLAGS, "-mcpu=cortex-m3") &&
>   is_substr(CYGBLD_GLOBAL_CFLAGS, " -mcpu=cortex-m4 ") }
> which instead we will comment out for now until we are happy with gcc 4.6.3.
> 

I agree about CYGOPT_HAL_CORTEXM4_CODE removal, but I think that making
-mcpu=cortex-m4 mandatory for M4 is too inflexible. With present CDL it is
possible to edit CYGBLD_GLOBAL_CFLAGS and change -mcpu. And somebody will want
to try M4 with cortex-m3 code.

Therefore I think that the idea about CYGBLD_ARCH_XFLAGS is good. It will
provide -mcpu=  default value which can later be edited. This will require us
to touch some platform CDL files but we only have to deal with M4 devices with
FPU and they are few (though we can see if we want to "canonize" other
platforms).


> All the M3-based platform HALs will have their CFLAGS default to
> -mcpu=cortex-m3, and the M4 HALs will have -mcpu=cortex-m4 -mfloat-abi=hard
> -mfpu=fpv4-sp-d16.

FAOD, there are cortex-m4 devices without FPU as well.

> And until we are happy with the gcc 4.6 tools, anyone using cortex-m4 with
> older tools can just manually edit the value of CYGBLD_GLOBAL_CFLAGS/LDFLAGS to
> change the values, and we can put a note to that effect in the CDL description
> and the platform documentation. So the CDL may say it is an M4, but it won't
> complain if you compile with -mcpu=cortex-m3 for now. We can put these checks
> back in later instead.
> 
> I think asking people to do this is better than forcing them to understand how
> all the many configuration options are related.
> 
> So I really do think this is the way we should go.
> 

We can apply following changes to CYGHWR_HAL_FPV4_SP_D16 and enforce correct
-mcpu for -mfloat:
-    requires { is_substr(CYGBLD_GLOBAL_CFLAGS, " -mfloat-abi=hard
-mfpu=fpv4-sp-d16") }
-    requires { is_substr(CYGBLD_GLOBAL_LDFLAGS, " -mfloat-abi=hard
-mfpu=fpv4-sp-d16") }
+    requires { is_substr(CYGBLD_GLOBAL_CFLAGS, " -mcpu=cortexm4
-mfloat-abi=hard -mfpu=fpv4-sp-d16") }
+    requires { !is_substr(CYGBLD_GLOBAL_CFLAGS, "-mcpu=cortexm3") }
+    requires { is_substr(CYGBLD_GLOBAL_LDFLAGS, " -mcpu=cortexm4
-mfloat-abi=hard -mfpu=fpv4-sp-d16") }
+    requires { !is_substr(CYGBLD_GLOBAL_LDFLAGS, "-mcpu=cortexm3") }

> Other comments:
> 2) The declaration of "cdl_interface CYGINT_HAL_CORTEXM_FPU" can live in
> hal_cortexm_fpu.cdl instead just to keep it all together.
> 

OK.


> 4) You don't need the CYGHWR_HAL_FPU_ANTIFLAGS option. While I'm amused by the
> name :-), it probably isn't clear to anyone browsing the configuration what its
> purpose is really. As a little cheat, you can place these requirements inside
> the CYGINT_HAL_CORTEXM_FPU block (assuming it's useful to keep it in
> hal_cortexm_fpu.cdl rather than under CYGPKG_HAL_CORTEXM_FPU in
> hal_cortexm.cdl). The reason this works is because a CDL interface is still
> considered to be "active" and "enabled" even if nothing "implements" it. As
> long as its parent in the configuration tree is, anyway. This would get rid of
> the ANTIFLAGS option entirely which is a useful tidy.

I just learnt something about cdl_interface, thanks.

> 
> 5) I think CYGHWR_HAL_FPV4_SP_D16 can live under the CYGHWR_HAL_CORTEXM_FPU
> component.

CYGHWR_HAL_FPV4_SP_D16 is a FPU instance. As you say in future there may be
others. Do we want them under CYGHWR_HAL_CORTEXM_FPU?

> 
> 6) A general comment as something which can be done last thing before check-in,
> and I know it's only a cosmetic thing, but contents of options are a little
> more readable if things are aligned. For example:
>            cdl_option CYGHWR_HAL_CORTEXM_FPU_SWITCH {
>                display "FPU context switch"
>                flavor data
>                legal_values { "ALL" "LAZY" "NONE" }
>                default_value { "LAZY" }
>                description "
> is clearer to read as:
>            cdl_option CYGHWR_HAL_CORTEXM_FPU_SWITCH {
>                display       "FPU context switch"
>                flavor        data
>                legal_values  { "ALL" "LAZY" "NONE" }
>                default_value { "LAZY" }
>                description   "
> and so on.
> 
> Apologies if you were going to do this anyway :-).
> 

There are other places like this. My intention is to check them wehen we came
close to commit.


> I'll make my other comments in the next bugzilla entry...
Let's carry on...

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]