Re: APM32F0 support

2023-10-25 Thread kristof . mulier
Hi Jim,

Getting the boards is not an issue. Geehy also donated boards to us - no problem
there. I can ask them to send boards to you - or anyone in the OpenOCD community
who is willing to fix that APM32 merge request.

The problem is a financial contribution. An actual payment needs to go through
several layers of management, which takes time.

If you like to receive some Geehy boards,
just send me your address.

Kind regards,
Kristof



- Oorspronkelijk bericht -
Van: "j. m. norris" 
Aan: "openocd-devel" 
Verzonden: Woensdag 25 oktober 2023 14:25:09
Onderwerp: Re: APM32F0 support

Kristof,

I can understand 'big company mentality'. However, if they can't afford to 
'donate'
a board(s) for the purpose of developing the needed changes to OpenOCD, then
asking someone to purchase a board and donate their time to do the changes
is probably expecting too much.

I was in a similar situation, however, the company I made the OpenOCD changes
for provided me with the appropriate boards. While this didn't compensate me
for my time to do the changes, at least it added the OpenOCD code base.

Regards,
Jim



Re: APM32F0 support

2023-10-25 Thread j. m. norris

Kristof,

I can understand 'big company mentality'. However, if they can't afford to 
'donate'
a board(s) for the purpose of developing the needed changes to OpenOCD, then
asking someone to purchase a board and donate their time to do the changes
is probably expecting too much.

I was in a similar situation, however, the company I made the OpenOCD changes
for provided me with the appropriate boards. While this didn't compensate me
for my time to do the changes, at least it added the OpenOCD code base.

Regards,
Jim




Re: APM32F0 support

2023-10-25 Thread Tommy Murphy
> Unfortunately, the patch was not accepted. I don't know why exactly

It's explained in the review comment from Tomas Vanek:


Thanks for the patch.
Unfortunately the flash driver is a copy of stm32 original with a couple of 
changes.
We cannot accept such huge duplicity of code. Imagine we would had one (or 
more) flash driver for each of numerous STM32 clones: GD32, MM32, AT32, APM32, 
CS32, CH32 and probably others. How we would maintain such code?

Please check if APM32 could be supported by stm32 flash drivers.
If you propose some changes to the driver code, always comment that the code is 
relevant to APM32 or whatever variant. Don't forget to update doc/openocd.texi

As a starting point take a look at
7110: Add support for Geehy Cortex-M0+ controllers proposed by Paul Fertser on 
the user mailing list | https://review.openocd.org/c/openocd/+/7110
(the commit msg is also wrong)

The support of 'variant' devices was discussed in

6543: add GigaDevice GD32Exxx flash driver | 
https://review.openocd.org/c/openocd/+/6543


Re: APM32F0 support

2023-10-17 Thread Alan C. Assis
Hi Tommy,

I think the basic support for APM32F0 was also in that patch that was
abandoned (rejected) here:

https://review.openocd.org/c/openocd/+/7421

There is an explanation for the rejection in the thread.

Maybe new chip versions will depart from STM32 and could need a
separated driver, let's see.

BR,

Alan

On 10/17/23, Tommy Murphy  wrote:
> Not sure if anybody mentioned this patch already just in case it's relevant
> here?
>
> https://sourceforge.net/p/openocd/mailman/message/37753998/
>



Re: APM32F0 support

2023-10-17 Thread Tommy Murphy
Not sure if anybody mentioned this patch already just in case it's relevant 
here?

https://sourceforge.net/p/openocd/mailman/message/37753998/


Re: APM32F0 support

2023-10-15 Thread Paul Fertser
Hi,

I didn't remember anything about that but
https://review.openocd.org/q/message:geehy

gives some hints.

On Sun, Oct 15, 2023 at 11:24:01AM +0200, kristof.mul...@telenet.be wrote:
> > What happens if you use stm32f0x.cfg config?
>     Error: Cannot identify target as a stm32x

Apparently with https://review.openocd.org/c/openocd/+/7110 applied
you can just use stm23f1x.cfg (f1!) config with apm32f0 (with
appropriate CPUTAPID), I suggest you give it a try.

-- 
Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software!
mailto:fercer...@gmail.com



Re: APM32F0 support

2023-10-15 Thread Tomas Vanek

On 15/10/2023 11:24, kristof.mul...@telenet.be wrote:

Hi Paul and Liviu,

> What happens if you use stm32f0x.cfg config?

Then I get the following problem:

    ** Programming Started **
    Error: Cannot identify target as a stm32x
    Error: auto_probe failed
embedded:startup.tcl:1524: Error: ** Programming Failed **
    in procedure 'program'
    in procedure 'program_error' called at file 
"embedded:startup.tcl", line 1589

    at file "embedded:startup.tcl", line 1524


> I have experience with APM32F103CBT6, it works fine with the existing
> script, just needs an ID for a newer Cortex-M variant to be set, can
> be done without modifying the stm32f1x.cfg at all, just by setting the
> variable beforehand.

Great! But where can I find the ID for the MCU? How do I change it in
the config file?

Kind regards,
Kristof Mulier



A pending patch

7110: Add support for Geehy Cortex-M0+ controllers proposed by Paul 
Fertser on the user mailing list | 
https://review.openocd.org/c/openocd/+/7110


may fix flash probe. Please test and write a review.

Tomas

Re: APM32F0 support

2023-10-15 Thread Paul Fertser
On Sun, Oct 15, 2023 at 11:24:01AM +0200, kristof.mul...@telenet.be wrote:
> Hi Paul and Liviu,
> > What happens if you use stm32f0x.cfg config?
> Then I get the following problem:
>     ** Programming Started **
>     Error: Cannot identify target as a stm32x

OK, so the flash driver isn't compatible. One would need to check the
datasheet and see what really differs there.

> > I have experience with APM32F103CBT6, it works fine with the existing
> > script, just needs an ID for a newer Cortex-M variant to be set, can
> > be done without modifying the stm32f1x.cfg at all, just by setting the
> > variable beforehand.
>
> Great! But where can I find the ID for the MCU? How do I change it in
> the config file?

When ID is mismatched OpenOCD reports it in message. You do not need
to change it in the config file though, just doing
-c "set CPUTAPID 0x2ba01477" -f target/stm32f1x.cfg

is enough to get APM32F103 working with OpenOCD.

-- 
Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software!
mailto:fercer...@gmail.com



Re: APM32F0 support

2023-10-15 Thread Tommy Murphy
> Great! But where can I find the ID for the MCU? How do I change it in the 
> config file?

What happens if you try autoprobing?
See section 10.7 - Autoprobing of the OpenOCD User's Guide:

https://openocd.org/pages/documentation.html

Once you know the IDCODE for the APM32F0 you can try making a copy of the 
stm32f1x.cfg file and changing the IDCODE here:

https://github.com/openocd-org/openocd/blob/c7d1f0ddabb301e00738686671b939bb92a06ed9/tcl/target/stm32f1x.cfg#L35

Alternatively, temporarily suppress IDCODE checking by changing this and see 
what happens:

https://github.com/openocd-org/openocd/blob/c7d1f0ddabb301e00738686671b939bb92a06ed9/tcl/target/stm32f1x.cfg#L48C76-L48C86

to

... -expected-id 0