Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.arch.embedded > #27778

Re: arm-gcc: avoid calling other system functions

From Tauno Voipio <tauno.voipio@notused.fi.invalid>
Newsgroups comp.arch.embedded
Subject Re: arm-gcc: avoid calling other system functions
Date 2018-05-22 15:24 +0300
Organization A noiseless patient Spider
Message-ID <pe126a$86e$1@dont-email.me> (permalink)
References (2 earlier) <pdlu31$43o$1@dont-email.me> <pdm0mm$ifn$1@dont-email.me> <-qydnZ8LX987f5_GnZ2dnUU7-VmdnZ2d@earthlink.com> <pduvq8$8mv$1@dont-email.me> <pe0fgf$s5l$1@dont-email.me>

Show all headers | View raw


On 22.5.18 10:05, pozz wrote:
> Il 21/05/2018 19:31, David Brown ha scritto:
>> On 21/05/18 17:15, Joe Chisolm wrote:
>>> On Fri, 18 May 2018 09:51:50 +0200, David Brown wrote:
>>>
>>>> On 18/05/18 09:07, pozz wrote:
>>>>> Il 17/05/2018 17:06, David Brown ha scritto:
>>>>>> On 17/05/18 14:37, pozz wrote:
>>>>>>> I'm trying to put all ISRs in RAM[*]. Unfortunately, depending on 
>>>>>>> the
>>>>>>> code, arm-gcc could call some system functions that are located in
>>>>>>> Flash.
>>>>>>>
>>>>>>> For example, if I use a switch statement, the compiler calls a piece
>>>>>>> of code of system libraries (that are in Flash) that use a table
>>>>>>> lookup to manage the switch.
>>>>>>>
>>>>>>> Is it possible to force arm-gcc to avoid calling system functions
>>>>>>> from ISRs, so it can be executed completely in RAM?
>>>>>>
>>>>>> There is, AFAIK, no way to force this.  It is not normally a problem
>>>>>> as ISRs should generally be as short and fast as possible.
>>>>>
>>>>> I always try to keep the ISR short, simple and fast.  However a simple
>>>>> switch statement (a different way to write a sequence of if 
>>>>> statements)
>>>>> is compiled in assembler code that uses "libgcc functions".
>>>>
>>>> Can you give an small example here?  That sounds very strange.  gcc can
>>>> use a variety of tactics for switch statements, including jump tables,
>>>> calculated jumps, sequences of conditional tests, and binary trees of
>>>> conditional tests - and combinations of these.  But I can't think of 
>>>> any
>>>> situation where it would use a language support function (at least, not
>>>> on an ARM).
>>>>
>>> [ snip ]
>>>
>>>
>>> This all started back in 2009.  For the stated minor savings in code
>>> space vs all the headaches it causes I think there should be a specific
>>> switch to override this.  Maybe there is.
>>>
>>> https://gcc.gnu.org/ml/gcc-patches/2009-06/msg01698.html
>>>
>>>
>>
>> So we are talking about Thumb1 code - a mode that has been outdated 
>> for many years, and is almost certainly irrelevant to the OP's 
>> question? (Thumb1 is very different from Thumb2, used by the Cortex-M 
>> devices.)
> 
> I don't know if my compiler generates Thumb1 or Thumb2 (or a mix of) 
> code.  Anyway I remember the libgcc function that is called is 
> __gnu_thumb1_case_uqi.

Your compiler command is missing the mcpu=cortex-m4 (or -mcpu=cortx-m3)
switch on the command line.

-- 

-TV

Back to comp.arch.embedded | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

arm-gcc: avoid calling other system functions pozz <pozzugno@gmail.com> - 2018-05-17 14:37 +0200
  Re: arm-gcc: avoid calling other system functions Grant Edwards <invalid@invalid.invalid> - 2018-05-17 13:27 +0000
    Re: arm-gcc: avoid calling other system functions pozz <pozzugno@gmail.com> - 2018-05-17 15:35 +0200
      Re: arm-gcc: avoid calling other system functions Grant Edwards <invalid@invalid.invalid> - 2018-05-17 14:18 +0000
        Re: arm-gcc: avoid calling other system functions David Brown <david.brown@hesbynett.no> - 2018-05-17 17:08 +0200
        Re: arm-gcc: avoid calling other system functions pozz <pozzugno@gmail.com> - 2018-05-18 08:47 +0200
  Re: arm-gcc: avoid calling other system functions pozz <pozzugno@gmail.com> - 2018-05-17 15:30 +0200
  Re: arm-gcc: avoid calling other system functions David Brown <david.brown@hesbynett.no> - 2018-05-17 17:06 +0200
    Re: arm-gcc: avoid calling other system functions pozz <pozzugno@gmail.com> - 2018-05-18 09:07 +0200
      Re: arm-gcc: avoid calling other system functions David Brown <david.brown@hesbynett.no> - 2018-05-18 09:51 +0200
        Re: arm-gcc: avoid calling other system functions pozz <pozzugno@gmail.com> - 2018-05-21 09:14 +0200
          Re: arm-gcc: avoid calling other system functions David Brown <david.brown@hesbynett.no> - 2018-05-21 12:50 +0200
        Re: arm-gcc: avoid calling other system functions Joe Chisolm <jchisolm6@earthlink.net> - 2018-05-21 10:15 -0500
          Re: arm-gcc: avoid calling other system functions David Brown <david.brown@hesbynett.no> - 2018-05-21 19:31 +0200
            Re: arm-gcc: avoid calling other system functions pozz <pozzugno@gmail.com> - 2018-05-22 09:05 +0200
              Re: arm-gcc: avoid calling other system functions David Brown <david.brown@hesbynett.no> - 2018-05-22 10:59 +0200
              Re: arm-gcc: avoid calling other system functions Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2018-05-22 15:24 +0300
                Re: arm-gcc: avoid calling other system functions pozz <pozzugno@gmail.com> - 2018-05-22 14:55 +0200
  Re: arm-gcc: avoid calling other system functions Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2018-05-18 12:41 +0300

csiph-web