Comments (6)
Thanks for your time and work.
From what I've read, c++17 renders this type of gpsim exception statement as an error. Using c++14 it is just a warning. I believe that adding the -std=c++14
option to clang++ the code should compile.
Using g++ should compile just fine, try removing the -flto
option from makefiles, it's usually not very compatible.
from picsimlab.
Hi @fathonix ,
qemu-system-xtensa -M esp32-picsimlab
needs some initialization to work done by PICSimLab. I tweaked the code to work stand alone with this commit https://github.com/lcgamboa/qemu_stm32/commit/08ac82cc995683480333a9a73f66141e0826b4ca.
The problem of getting hang is because PICSimLab reads the status of the DTR/RTS pins of the serial port to reset the simulated boards for flashing the programs by avrdude and esptool.py. As you are using a pts without signals from these pins, the simulator enters a continuous reset state. To work with pts I can add an option to disable the DTR/RTS check, but for avrdude and esptoo.py to work it would be necessary to reset the boards manually and at the exact moment (I'm not sure if that would work). For you to be able to do your tests just choose a real or invalid serial port for the simulator to run.
Thank you for your time and collaboration.
from picsimlab.
Thanks for your feedback.
I've tried adding -std=c++14
and the GPSim errors are finally gone. But I ran into errors like this:
error: value of type '__bind<int &, sockaddr *, unsigned long>' is not contextually convertible to 'bool'
But quick search gave me the clue and I fixed it by replacing bind()
with ::bind()
in devices/mplabxd.cc and devices/rcontrol.cc. Finally, PICSimLab was built successfully. (woohoo!)
I tried to flash some example programs to Uno simulator through pts-mode tty0tty and it worked like a charm. But once I switched to ESP32, I noticed that it had some issues connecting to the TTY. After confirming my configurations, PICSimLab hanged.
With arguments printed in the logs, I tried running:
./qemu-system-xtensa -M esp32-picsimlab -L /opt/lib/picsimlab/qemu/fw/ -drive file=/Users/aldo/Library/Application\ Support/picsimlab/mdump_ESP32_DevKitC_ESP32.bin,if=mtd,format=raw -icount shift=5,align=off,sleep=on -nic user,model=esp32_wifi,net=192.168.4.0/24,hostfwd=tcp::16555-192.168.4.15:80 -global driver=timer.esp32.timg,property=wdt_disable,value=true
Aaaand I got SEGV, here's the logs from macOS:
Process: qemu-system-xtensa [49704]
Path: /Users/USER/*/qemu-system-xtensa
Identifier: qemu-system-xtensa
Version: ???
Code Type: ARM-64 (Native)
Parent Process: zsh [39492]
Responsible: iTerm2 [1389]
User ID: 501
Date/Time: 2023-02-09 21:38:36.8176 +0300
OS Version: macOS 12.4 (21F79)
Report Version: 12
Anonymous UUID: 34581243-0F39-C375-0911-465CC4B97213
Sleep/Wake UUID: A932D94F-0F3A-4720-A775-8B12DF635409
Time Awake Since Boot: 36000 seconds
Time Since Wake: 8659 seconds
System Integrity Protection: enabled
Crashed Thread: 3
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Codes: 0x0000000000000001, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process: exc handler [49704]
VM Region Info: 0 is not in any region. Bytes before following region: 4371185664
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
UNUSED SPACE AT START
--->
__TEXT 1048b0000-1050f4000 [ 8464K] r-x/r-x SM=COW ...system-xtensa
Thread 0:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x1a92d5598 __select + 8
1 libglib-2.0.0.dylib 0x106153090 g_poll + 424
2 qemu-system-xtensa 0x104f5eac4 qemu_poll_ns + 64 (qemu-timer.c:351)
3 qemu-system-xtensa 0x104f59e0c os_host_main_loop_wait + 88 (main-loop.c:257)
4 qemu-system-xtensa 0x104f59d1c main_loop_wait + 188 (main-loop.c:538)
5 qemu-system-xtensa 0x104ca2c30 qemu_main_loop + 32 (runstate.c:726)
6 qemu-system-xtensa 0x104d9e338 main + 56 (main.c:50)
7 dyld 0x10606108c start + 520
Thread 1:
0 libsystem_kernel.dylib 0x1a92ce06c __semwait_signal + 8
1 libsystem_c.dylib 0x1a91d6fc8 nanosleep + 220
2 libglib-2.0.0.dylib 0x10616bef0 g_usleep + 72
3 qemu-system-xtensa 0x104f3e554 call_rcu_thread + 164 (rcu.c:253)
4 qemu-system-xtensa 0x104f31f60 qemu_thread_start + 176 (qemu-thread-posix.c:556)
5 libsystem_pthread.dylib 0x1a930826c _pthread_start + 148
6 libsystem_pthread.dylib 0x1a930308c thread_start + 8
Thread 2:
0 libsystem_kernel.dylib 0x1a92d5f10 __sigwait + 8
1 libsystem_pthread.dylib 0x1a9308a48 sigwait + 40
2 qemu-system-xtensa 0x104f2dd4c sigwait_compat + 56 (compatfd.c:36)
3 qemu-system-xtensa 0x104f31f60 qemu_thread_start + 176 (qemu-thread-posix.c:556)
4 libsystem_pthread.dylib 0x1a930826c _pthread_start + 148
5 libsystem_pthread.dylib 0x1a930308c thread_start + 8
Thread 3 Crashed:
0 ??? 0x0 ???
1 qemu-system-xtensa 0x104da690c qemu_set_irq + 68
2 qemu-system-xtensa 0x104a03c64 esp32_iomux_write + 176 (esp32_iomux.c:169)
3 qemu-system-xtensa 0x104ca52b4 memory_region_write_accessor + 296 (memory.c:492)
4 qemu-system-xtensa 0x104ca5154 access_with_adjusted_size + 516 (memory.c:554)
5 qemu-system-xtensa 0x104ca4d98 memory_region_dispatch_write + 276 (memory.c:1504)
6 qemu-system-xtensa 0x104d99c7c io_writex + 276 (cputlb.c:1420)
7 qemu-system-xtensa 0x104d8b7f4 store_helper + 656 (cputlb.c:2355)
8 qemu-system-xtensa 0x104d8b460 full_le_stl_mmu + 76 (cputlb.c:2443)
9 qemu-system-xtensa 0x104d8b408 helper_le_stl_mmu + 60 (cputlb.c:2449)
10 ??? 0x2c0025ca0 ???
11 qemu-system-xtensa 0x104d77fb4 cpu_tb_exec + 96 (cpu-exec.c:357)
12 qemu-system-xtensa 0x104d791bc cpu_loop_exec_tb + 64 (cpu-exec.c:842)
13 qemu-system-xtensa 0x104d78770 cpu_exec + 564 (cpu-exec.c:1001)
14 qemu-system-xtensa 0x104d9acf0 tcg_cpus_exec + 88 (tcg-accel-ops.c:67)
15 qemu-system-xtensa 0x104d9bd7c rr_cpu_thread_fn + 876 (tcg-accel-ops-rr.c:223)
16 qemu-system-xtensa 0x104f31f60 qemu_thread_start + 176 (qemu-thread-posix.c:556)
17 libsystem_pthread.dylib 0x1a930826c _pthread_start + 148
18 libsystem_pthread.dylib 0x1a930308c thread_start + 8
Thread 4:
0 libsystem_kernel.dylib 0x1a92ce270 __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x1a930883c _pthread_cond_wait + 1236
2 qemu-system-xtensa 0x104f31674 qemu_sem_timedwait + 136 (qemu-thread-posix.c:303)
3 qemu-system-xtensa 0x104f5dc00 worker_thread + 196 (thread-pool.c:91)
4 qemu-system-xtensa 0x104f31f60 qemu_thread_start + 176 (qemu-thread-posix.c:556)
5 libsystem_pthread.dylib 0x1a930826c _pthread_start + 148
6 libsystem_pthread.dylib 0x1a930308c thread_start + 8
Thread 3 crashed with ARM Thread State (64-bit):
x0: 0x00000000ffffffff x1: 0x00000000ffffbfff x2: 0x00000000ffffbfff x3: 0x00000000000000a1
x4: 0x0000000104f9257f x5: 0x00000000ffffffff x6: 0x000000006b000001 x7: 0x000000016b000001
x8: 0x0000000000000000 x9: 0x0000600003540e00 x10: 0x0000000104a040b4 x11: 0x0000000000000084
x12: 0x00007a0000007a02 x13: 0x00007a0000007a00 x14: 0x00000000a6e05000 x15: 0x000000000000000a
x16: 0x00000001a93027c0 x17: 0x00006000015940c0 x18: 0x0000000000000000 x19: 0x0000000140020be0
x20: 0x0000000000000800 x21: 0x000000003ff49088 x22: 0x0000000000000000 x23: 0x0000000000000000
x24: 0x0000000000000000 x25: 0x0000000000000000 x26: 0x0000000000000000 x27: 0x0000000000000000
x28: 0x0000000000000000 fp: 0x000000016b6ee400 lr: 0x0000000104b360ac
sp: 0x000000016b6ee3f0 pc: 0x0000000000000000 cpsr: 0x80001000
far: 0x0000000000000000 esr: 0x82000006 (Instruction Abort) Translation fault
Binary Images:
0x1a92c9000 - 0x1a9300fff libsystem_kernel.dylib (*) <03f48dc5-caa7-3678-af61-1a3c7fa8b06e> /usr/lib/system/libsystem_kernel.dylib
0x106110000 - 0x1061f7fff libglib-2.0.0.dylib (*) <17a0a189-d923-3df6-a590-48c7619731f5> /opt/homebrew/*/libglib-2.0.0.dylib
0x1048b0000 - 0x1050f3fff qemu-system-xtensa (*) <46d089ca-e439-314c-abfd-b6307b76f618> /Users/USER/*/qemu-system-xtensa
0x10605c000 - 0x1060bbfff dyld (*) <d9c2a46e-8dc4-3950-9d6a-f799e8ccb683> /usr/lib/dyld
0x1a91c8000 - 0x1a9249fff libsystem_c.dylib (*) <86746b94-88e3-342d-b2b2-54303404e492> /usr/lib/system/libsystem_c.dylib
0x1a9301000 - 0x1a930dfff libsystem_pthread.dylib (*) <42166a2c-89a9-3c38-a215-f028544cea23> /usr/lib/system/libsystem_pthread.dylib
0x0 - 0xffffffffffffffff ??? (*) <00000000-0000-0000-0000-000000000000> ???
External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
VM Region Summary:
ReadOnly portion of Libraries: Total=677.4M resident=0K(0%) swapped_out_or_unallocated=677.4M(100%)
Writable regions: Total=2.1G written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=2.1G(100%)
VIRTUAL REGION
REGION TYPE SIZE COUNT (non-coalesced)
=========== ======= =======
Activity Tracing 256K 1
Kernel Alloc Once 32K 1
MALLOC 268.2M 30
MALLOC guard page 96K 5
MALLOC_MEDIUM (reserved) 440.0M 4 reserved VM address space (unallocated)
MALLOC_NANO (reserved) 384.0M 1 reserved VM address space (unallocated)
STACK GUARD 56.1M 5
Stack 10.1M 5
VM_ALLOCATE 130.5M 22
VM_ALLOCATE (reserved) 24.3M 11 reserved VM address space (unallocated)
__AUTH 220K 44
__AUTH_CONST 2892K 123
__DATA 4308K 126
__DATA_CONST 5778K 133
__DATA_DIRTY 233K 50
__LINKEDIT 586.6M 11
__OBJC_CONST 260K 29
__OBJC_RO 83.0M 1
__OBJC_RW 3152K 1
__TEXT 90.7M 139
__UNICODE 592K 1
dyld private memory 1024K 1
shared memory 1.9G 18
=========== ======= =======
TOTAL 3.9G 762
TOTAL, minus reserved VM space 3.1G 762
I guess this is the one that caused the hang but I don't really understand what was going on.
from picsimlab.
Thank you very much for your time and help.
I can confirm that qemu-system-xtensa -M esp32-picsimlab
doesn't crash anymore (thanks!). I can also confirm that everytime I had flashed to Uno once, I had to reset the board either by selecting Arduino Bootloader or restarting the app sometimes, which I think it's because the IDE uses avrdude internally.
Regarding the serial, I'm still trying to find a virtual serial driver for macOS. Many people suggested MacOSXVirtualSerialPort, which is very outdated and doesn't work on modern macOS. But I found another driver and this one runs on newer macOS but still in early stage. The problem is that this driver isn't signed so it needs System Integrity Protection disabled, and I don't think that's the best idea. But signing requires Apple Developer membership and it costs $99 annually.
After fiddling around with Xcode build settings and macOS security stuff, apparently the driver is broken. I got it to run, I could connect on one side but the other side just threw "Resource busy." I don't put much hope on it either, since the dev kind of already abandoned it (the last commit is from 2018).
from picsimlab.
I'm going to put an option to be able to disable the use of DTR/DSR to work with the pts without getting hang.
Another solution can be to use PICSimLab's TCP/IP rcontrol interface to load the programs. Here is a small program that loads a .hex into an open instance of PICSimLab .
from picsimlab.
I have implemented the option to disable DTR/RTS signals use in commits 573dc9c and 96f0a09. Use the menu File->configure
With the option disabled, the reset must be done manually to flash the board.
To use with avrdude just reset at the beginning of the flashing attempt.
To use with esptool.py, click on the BOOT button and drag the pointer out of the button leaving it pressed, click on the EN button and click on the BOOT button again, with that the ESP32 will be in boot mode.
from picsimlab.
Related Issues (20)
- stm32 is using a qemu version that is too old and zephyr is crashing HOT 18
- [TIP] Installing on Ubuntu 18.04.5
- gdk pixbuf error HOT 9
- PicsimLab will not run HOT 7
- I2C is not working on BluePill HOT 3
- PIC18F26K80 HOT 4
- LEDs with push button don't hold up on continuous press HOT 3
- Load Cell & HX711 Module HOT 3
- PICGenios 4 digit 7 segment multiplexing uneven contrast HOT 4
- Cannot build PICSimlab 0.8.12 from source HOT 1
- Error loading saved Workspace on Windows HOT 2
- Remote TCP interface HOT 14
- ESP32 DevKitC ethernet example HOT 5
- PinViewer crash HOT 4
- The application freeze and exit on gpboard HOT 3
- Support RISC-V MCUs simulation HOT 2
- Hangs with com0com HOT 2
- Support for PIC16F819,PIC16F1827 and PIC16F1847 HOT 7
- Can't build for macOS from source
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from picsimlab.