ilg-archived / qemu

The GNU MCU Eclipse QEMU
http://gnuarmeclipse.github.io/qemu/
Other
205 stars 78 forks source link

-memory size=kb not working? #63

Closed lujnan closed 5 years ago

lujnan commented 5 years ago

Description

I want to resize the sram size, The project about Neural net that need more memory. how to config sram size?

Versions

ilg-ul commented 5 years ago

where is the bug?

lujnan commented 5 years ago

--mcu STM32F407VG -d unimp,guest_errors \
**-global sram-size-kb=512 \**
--nographic --image mytest.elf \
--semihosting-config enable=on,target=native \
--semihosting-cmdline mytest ```
lujnan commented 5 years ago

the option '-global sram-size-kb' is not available. how can i run and debug demo on qemu that need more memory?

ilg-ul commented 5 years ago

The list of supported command line options is: https://gnu-mcu-eclipse.github.io/qemu/options/

Where does the -global option come from?

lujnan commented 5 years ago

global option

-global driver.property=value
-global driver=driver,property=property,value=value
                set a global default for a driver property

sram-size-kb

from mcu.c source file.

ilg-ul commented 5 years ago

Ah, ok, I'll check what happened to -global, and if still legal, I'll fix it and add to the documentation.

lujnan commented 5 years ago

Hi, @ilg-ul I see 'qemu' has another option

-m[emory] [size=]megs[,slots=n,maxmem=size]
                configure guest RAM
                size: initial amount of guest memory
                slots: number of hotplug slots (default: none)
                maxmem: maximum amount of guest memory (default: none)
ilg-ul commented 5 years ago

thank you @lujnan for the hint, qemu has lots of options, some contradictory, I'm not sure which one were available when I added the Cortex-M code.

if you are comfortable with checking the source code, any additional help to identify the best solution will be highly appreciated.

ilg-ul commented 5 years ago

and a short comment/advice:

although it is possible in emulators to extend the memory size, this is generally not recommended, since one of the usual requirements is to validate the image intended for emulation by running it on a physical board.

as long as everything works just fine you do not face this, but as soon as something breaks, you'll question/suspect the emulator and probably want to run the image on a physical board.

lujnan commented 5 years ago

@ilg-ul Is it possible to create a specific board like the android does. (google's android emulator base on qemu, the board named 'goldfish'.)

ilg-ul commented 5 years ago

probably it is possible, but the focus of this project is Cortex-M, so for Linux devices you should use the 'standard' QEMU.

lujnan commented 5 years ago

@ilg-ul I have resolved my question by using the following sample. I now to close this issue. Thank you very much!

qemu-system-gnuarmeclipse --verbose --verbose --board generic \
--mcu STM32F429ZI --gdb tcp::1234 -d unimp,guest_errors \
--semihosting-config enable=on \
--semihosting-cmdline blinky
ilg-ul commented 5 years ago

yes, using a board with larger memory is the correct solution.

however, I'll reopen this ticket, since I still need to check why -global failed.

ilg-ul commented 5 years ago

-global sram-size-kb=512 is not legal, the correct syntax is -global driver.property=value, and does not apply to memory size.

-memory size=kb is legal, but the current code ignores it; to be fixed shortly.

ilg-ul commented 5 years ago

Fixed in 2019-02-26.

-memory size=kb sets the value into the machine object, and now the mcu object reads it from there.

TODO after publishing release: update the documentation.

ilg-ul commented 5 years ago

Fixed in 2.8.0-5.