Re: Malfunctionning qemu-system-arm ?

2021-03-09 Thread Liviu Ionescu



> On 9 Mar 2021, at 17:58, vincent Dupaquis  
> wrote:
> 
> Thanks for the responses, I'll have a check on this.

It is based on a bit old version of QEMU, but it is fully functional for the 
peripherals used by the CubeMX initialisations.

I use it to run unit-tests, as semihosted applications, for example:

https://github.com/micro-os-plus/micro-test-plus-xpack/blob/52b5e65fc865bc72c4c9d46ff016c13357247f54/tests/meta/CMakeLists.txt#L205

> On the other hand, it would be more on ST to invest on making those 
> emulations running ...

Yeah, sure...


Liviu




Re: Malfunctionning qemu-system-arm ?

2021-03-09 Thread vincent Dupaquis

Liviu,

Thanks for the responses, I'll have a check on this.

The issue not testing with the HAL is that as most people use it, qemu 
on these platforms is a bit useless for emulation.


On the other hand, it would be more on ST to invest on making those 
emulations running ...


Best regards,

Vincent.

Le 09/03/2021 à 15:37, Liviu Ionescu a écrit :



On 15 Feb 2021, at 17:09, vincent Dupaquis  
wrote:

... stuck on the starting HAL_init() call.

HAL requires, amongst other things, the clock registers, since it sets the PLLs 
for the desired frequencies.

xPack QEMU Arm [1] implements these registers, and is able to properly run the 
HAL init code.


Regards,

Liviu

[1] - https://xpack.github.io/qemu-arm/


--

*Vincent Dupaquis*
Software security & Cryptography expert
06 24 58 17 05
/Europarc de Pichaury Bâtiment B8 1330 rue Guillibert Gautier de la 
Lauzière 13290 Aix-en-Provence/


www.trusted-objects.com 



Re: Malfunctionning qemu-system-arm ?

2021-03-09 Thread vincent Dupaquis

Alistair,

I am pretty sure that stepping-in somehow solves the issue, I did want 
to see where the problem appeared and this behaviour was making it very 
difficult to spot :/


Regards,

Vincent.

Le 09/03/2021 à 15:19, Alistair Francis a écrit :

On Mon, Feb 15, 2021 at 11:37 AM vincent Dupaquis
 wrote:

 Hello,

 I am using qemu-system-arm with a netduino2 target, supposingly
integrating a STM32F2xx chip.

 I tested using the STM HAL in order to make a simple program run,
and I just failed to have it running correctly, it satyed stuck on the
starting HAL_init() call.

 Debugging the code, it appeared that stepping-in was making the code
work while when running it it failed (stayed stuck in an infinite loop,
but no obvious arm violations).

 Has anyone any idea of what could be the cause for this ? I am using
the latest STM32 HAL, with a qemu version 5.1.0 on a Ubuntu 20.04
machine. What is the level of support this type of target is supposed to
have, and posibly which limitations should I take into account ?

Hey Vincent,

The model was never tested with the HAL. HALs commonly have infinite
loops inside them and it seems like you have hit one of them where the
HAL is waiting on some bit to change. I'm surprised that single
stepping fixes the problem though.

You will probably need to figure out where the loop is occuring
(either through GDB or prints/assembly/execution output), after which
it should be possible to fix the hang.

Alistair


 Best regards,
 Vincent.


--

*Vincent Dupaquis*
Software security & Cryptography expert
06 24 58 17 05
/Europarc de Pichaury Bâtiment B8 1330 rue Guillibert Gautier de la
Lauzière 13290 Aix-en-Provence/

www.trusted-objects.com 


--

*Vincent Dupaquis*
Software security & Cryptography expert
06 24 58 17 05
/Europarc de Pichaury Bâtiment B8 1330 rue Guillibert Gautier de la 
Lauzière 13290 Aix-en-Provence/


www.trusted-objects.com 



Re: Malfunctionning qemu-system-arm ?

2021-03-09 Thread Liviu Ionescu



> On 15 Feb 2021, at 17:09, vincent Dupaquis  
> wrote:
> 
> ... stuck on the starting HAL_init() call.

HAL requires, amongst other things, the clock registers, since it sets the PLLs 
for the desired frequencies.

xPack QEMU Arm [1] implements these registers, and is able to properly run the 
HAL init code.


Regards,

Liviu

[1] - https://xpack.github.io/qemu-arm/




Re: Malfunctionning qemu-system-arm ?

2021-03-09 Thread Alistair Francis
On Mon, Feb 15, 2021 at 11:37 AM vincent Dupaquis
 wrote:
>
> Hello,
>
> I am using qemu-system-arm with a netduino2 target, supposingly
> integrating a STM32F2xx chip.
>
> I tested using the STM HAL in order to make a simple program run,
> and I just failed to have it running correctly, it satyed stuck on the
> starting HAL_init() call.
>
> Debugging the code, it appeared that stepping-in was making the code
> work while when running it it failed (stayed stuck in an infinite loop,
> but no obvious arm violations).
>
> Has anyone any idea of what could be the cause for this ? I am using
> the latest STM32 HAL, with a qemu version 5.1.0 on a Ubuntu 20.04
> machine. What is the level of support this type of target is supposed to
> have, and posibly which limitations should I take into account ?

Hey Vincent,

The model was never tested with the HAL. HALs commonly have infinite
loops inside them and it seems like you have hit one of them where the
HAL is waiting on some bit to change. I'm surprised that single
stepping fixes the problem though.

You will probably need to figure out where the loop is occuring
(either through GDB or prints/assembly/execution output), after which
it should be possible to fix the hang.

Alistair

>
> Best regards,
> Vincent.
>
>
> --
>
> *Vincent Dupaquis*
> Software security & Cryptography expert
> 06 24 58 17 05
> /Europarc de Pichaury Bâtiment B8 1330 rue Guillibert Gautier de la
> Lauzière 13290 Aix-en-Provence/
>
> www.trusted-objects.com 
>



Malfunctionning qemu-system-arm ?

2021-02-15 Thread vincent Dupaquis
    Hello,

    I am using qemu-system-arm with a netduino2 target, supposingly
integrating a STM32F2xx chip.

    I tested using the STM HAL in order to make a simple program run,
and I just failed to have it running correctly, it satyed stuck on the
starting HAL_init() call.

    Debugging the code, it appeared that stepping-in was making the code
work while when running it it failed (stayed stuck in an infinite loop,
but no obvious arm violations).

    Has anyone any idea of what could be the cause for this ? I am using
the latest STM32 HAL, with a qemu version 5.1.0 on a Ubuntu 20.04
machine. What is the level of support this type of target is supposed to
have, and posibly which limitations should I take into account ?

    Best regards,
        Vincent.


-- 

*Vincent Dupaquis*
Software security & Cryptography expert
06 24 58 17 05
/Europarc de Pichaury Bâtiment B8 1330 rue Guillibert Gautier de la
Lauzière 13290 Aix-en-Provence/

www.trusted-objects.com