Why i can't run c++ code in micropython env esp32 - esp32

I am following this guide to run my C++ code in micropython environment, the normal/simple C++ code works on my ESP32 board but when i try running big loops it gives an error.
The error:
$ picocom -b 115200 /dev/ttyUSB0
picocom v3.1
port is : /dev/ttyUSB0
flowcontrol : none
baudrate is : 115200
parity is : none
databits are : 8
stopbits are : 1
escape is : C-a
local echo is : no
noinit is : no
noreset is : no
hangup is : no
nolock is : no
send_cmd is : sz -vv
receive_cmd is : rz -vv -E
imap is :
omap is :
emap is : crcrlf,delbs,
logfile is : none
initstring : none
exit_after is : not set
exit is : no
Type [C-a] [C-h] to see available commands
Terminal ready
>>> import cppexample
>>> cppexample.cppfunc()
abort() was called at PC 0x402acc26 on core 0
Backtrace:0x400912c6:0x3ffce1c0 0x40091989:0x3ffce1e0 0x400956ae:0x3ffce200 0x402acc26:0x3ffce270 0x40396985:0x3ffce290 0x40396ac5:0x3ffce2b0 0x400d3d73:0x3ffce2d0 0x400d4f53:0x3ffce390 0x402a7d26:0x3ffce3d0 0x402af51d:0x3ffce680 0x402b55f9:0x3ffce6a0 0x402b5726:0x3ffce6c0 0x402b77e1:0x3ffce6e0 0x402af6f0:0x3ffce780 0x402b55f9:0x3ffce7d0 0x402b5622:0x3ffce7f0 0x402e1847:0x3ffce810 0x402e1b99:0x3ffce8a0 0x402c69b0:0x3ffce8e0
ELF file SHA256: fe8de9466e5c428e
Rebooting...
ets Jul 29 2019 12:21:46
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:4
load:0x3fff0034,len:5572
load:0x40078000,len:12696
load:0x40080400,len:4292
entry 0x40080414
MicroPython v1.16-243-g8c4ba575f-dirty on 2021-09-20; ESP32 module with ESP32
Type "help()" for more information.
>>>
I got no idea what's happening,any help is appreciated

Related

Unexpected output from where-object

In PowerShell, this command:
Get-NetIPConfiguration | where-object {$_.IPv4Address.IPAddress -match '172.20'}
Is yielding this output:
InterfaceAlias : Wi-Fi
InterfaceIndex : 24
InterfaceDescription : Intel(R) Wi-Fi 6 AX201 160MHz
NetProfile.Name : Identifying...
IPv6Address : 2601:19b:c00:15c3:d80:ee8c:3679:1fe5
1::1
IPv4Address : 172.20.4.93
IPv6DefaultGateway : fe80::be98:dfff:feff:4acd
IPv4DefaultGateway : 172.20.4.1
DNSServer : fe80::be98:dfff:feff:4acd
InterfaceAlias : Local Area Connection 3
InterfaceIndex : 22
InterfaceDescription : TAP-Windows Adapter V9 #3
NetAdapter.Status : Disconnected
Whereas I would only expect to see this output:
InterfaceAlias : Wi-Fi
InterfaceIndex : 24
InterfaceDescription : Intel(R) Wi-Fi 6 AX201 160MHz
NetProfile.Name : Unidentified network
IPv6Address : 2601:19b:c00:15c3:d80:ee8c:3679:1fe5
1::1
IPv4Address : 172.20.4.93
IPv6DefaultGateway : fe80::be98:dfff:feff:4acd
IPv4DefaultGateway : 172.20.4.1
DNSServer : fe80::be98:dfff:feff:4acd
This is the full output from Get-NetIPConfiguration:
InterfaceAlias : VirtualBox Host-Only Network
InterfaceIndex : 11
InterfaceDescription : VirtualBox Host-Only Ethernet Adapter
IPv4Address : 169.254.249.136
IPv6DefaultGateway :
IPv4DefaultGateway :
DNSServer : fec0:0:0:ffff::1
fec0:0:0:ffff::2
fec0:0:0:ffff::3
InterfaceAlias : Local Area Connection
InterfaceIndex : 18
InterfaceDescription : TAP-Windows Adapter V9
NetProfile.Name : somerandomcompany.com
IPv4Address : 10.251.10.13
IPv6DefaultGateway :
IPv4DefaultGateway :
DNSServer : 10.255.0.9
10.255.0.8
InterfaceAlias : Wi-Fi
InterfaceIndex : 24
InterfaceDescription : Intel(R) Wi-Fi 6 AX201 160MHz
NetProfile.Name : PS-118 Guest
IPv6Address : 2601:19b:c00:15c3:d80:ee8c:3679:1fe5
1::1
IPv4Address : 192.168.0.208
IPv6DefaultGateway : fe80::be98:dfff:feff:4acd
IPv4DefaultGateway : 192.168.0.1
DNSServer : fe80::be98:dfff:feff:4acd
fe80::be98:dfff:feff:4acd
192.168.0.1
InterfaceAlias : Bluetooth Network Connection
InterfaceIndex : 9
InterfaceDescription : Bluetooth Device (Personal Area Network)
NetAdapter.Status : Disconnected
InterfaceAlias : Local Area Connection 3
InterfaceIndex : 22
InterfaceDescription : TAP-Windows Adapter V9 #3
NetAdapter.Status : Disconnected
InterfaceAlias : Local Area Connection 2
InterfaceIndex : 27
InterfaceDescription : TAP-Windows Adapter V9 #2
NetAdapter.Status : Disconnected
InterfaceAlias : OpenVPN Wintun
InterfaceIndex : 25
InterfaceDescription : Wintun Userspace Tunnel
NetAdapter.Status : Disconnected
I get the same result with PowerShell 7.2.5 and PowerShell 5.1.19041.1682, on Windows 10
Please let me know if I can provide any other information, and thank you for any help!

getting log from telnet session and writing relevant info to file but line gets overwritten by timestamp variable in expect script

Here is a sample remote session that I am automating
[sample-session]
$telnet 172.16.11.2
Trying 172.16.11.2...
Connected to 172.16.11.2.
Escape character is '^]'.
BCM96858 Broadband Router
Login: user
Password:
> voice show
Global Parameters:
------------------
BoundIfName : bronu8.2501
IP address family : IPv4
BoundIpAddr : 172.16.11.2
Voice Log Levels : general=3,cmgr=3,disp=3,sipcctk=3,bos=3,ept=3,cms=3,prov=3,lhapi=3,istw=3,dsphal=3,slicslac=3
Management Protocol : OMCI
Voice DNS Server Enable : Off
Voice DNS Server Primary : 0.0.0.0
Voice DNS Server Secondary : 0.0.0.0
Service Provider 0:
--------------------
Associated Voice Profile: 1
Locale : IND
DTMFMethod : InBand
HookFlashMethod : None
DigitMap : x+T
Log Server Addr : 0.0.0.0
Log Server Port : 0
T38 : on
V18 : on
RTPDSCPMark : 46
European flash : Off
SIP:
SIP mode : RFC3261
Domain :
Port : 5060
Transport : UDP
SIP URI for TLS calls: Off
RegExpires : 300
RegRetryInterval : 60
DSCPMark : 46
Registrar Addr : 172.16.11.201
Registrar Port : 5060
Proxy Addr : 172.16.11.201
Proxy Port : 5060
OutBoundProxy Addr : 172.16.11.201
OutBoundProxy Port : 5060
Music Server Addr : 0.0.0.0
Music Server Port : 0
Conferencing URI :
Conferencing Option : Local
Failover Enable : Off
Sip OPTIONS Enable : Off
Back-to-primary cfg : Disabled
Secondary Domain :
Secondary Registrar Addr : 0.0.0.0
Secondary Registrar Port : 5060
Secondary Proxy Addr : 0.0.0.0
Secondary Proxy Port : 5060
Secondary Outbound Proxy Addr : 0.0.0.0
Secondary Outbound Proxy Port : 5060
To Tag Matching : On
Timer B ( in ms ) : 32000
Timer F ( in ms ) : 32000
SRTP Usage Option : Disabled
Account 0:
-----------
ActivationStatus : Enabled
VoipServiceStatus : Up
CallStatus : Idle
Associated LineInst : 1
PhysEndpt : 0
Extension : 122
DisplayName :
AuthName : 122
AuthPwd : 0000
TxGain : 0 dB
RxGain : 0 dB
CALLFEATURES:
MWI : off
Caller ID number : on
Caller ID name : on
CallWaiting : on
CFWDNum :
CallFwdAll : off
CallFwdBusy : off
CallFwdNoans : off
AnonymousOutgoingCall: off
AnonymousCallRcvBlock: off
DoNotDisturb : off
CallCompOnBusy : off
SpeedDial : off
WarmLine : off
WarmLineNum :
CallBarring : off
CallBarringMode : None
CallBarringPin : 9999
CallBarringDigitMap :
NetPrivacy : on
CODECSETTINGS:
VAD : on
pTime : 20
CodecList : (0) G.711MuLaw
(1) G.711ALaw
(2) G.723.1
(3) G.726_16
(4) G.726_24
(5) G.726_32
Account 1:
-----------
ActivationStatus : Enabled
VoipServiceStatus : Up
CallStatus : Idle
Associated LineInst : 2
PhysEndpt : 1
Extension : 121
DisplayName :
AuthName : 121
AuthPwd : 0000
TxGain : 0 dB
RxGain : 0 dB
CALLFEATURES:
MWI : off
Caller ID number : on
Caller ID name : on
CallWaiting : on
CFWDNum :
CallFwdAll : off
CallFwdBusy : off
CallFwdNoans : off
AnonymousOutgoingCall: off
AnonymousCallRcvBlock: off
DoNotDisturb : off
CallCompOnBusy : off
SpeedDial : off
WarmLine : off
WarmLineNum :
CallBarring : off
CallBarringMode : None
CallBarringPin : 9999
CallBarringDigitMap :
NetPrivacy : on
CODECSETTINGS:
VAD : on
pTime : 20
CodecList : (0) G.711MuLaw
(1) G.711ALaw
(2) G.723.1
(3) G.726_16
(4) G.726_24
(5) G.726_32
> exit
Bye bye. Have a nice day!!!
Connection closed by foreign host.
[/sample-session]
My aim is to obtain lines containing ActivationStatus and VoipServiceStatus.
So I wrote this script
#!/usr/bin/expect -f
set timeout 2
set ip_addr [lindex $argv 0]
set OUTFILE "voip_status.log"
spawn telnet 172.16.11.$ip_addr
expect {
timeout { send_user "\nFailed to get login prompt for $ip_addr\n"; exit 1 }
eof { send_user "\ntelnet failure for server $ip_addr\n"; exit 2 }
"*Login:"
}
#expect "*Login:"
send -- "user\r"
expect "*Password:"
send -- "user\r"
expect ">"
send -- "voice show\r"
expect ">"
set voice_full_output $expect_out(buffer)
set voice_stat_lines [ split $voice_full_output "\n" ]
foreach line $voice_stat_lines {
if {[string match "*VoipServiceStatus*" $line]} {
set timestamp [timestamp -format %Y-%m-%d_%H:%M:%S]
set chan [open $OUTFILE a+]
#puts "ok - MATCH $line"
puts $chan "$line $timestamp"
close $chan
}
if {[string match "*ActivationStatus*" $line]} {
set chan [open $OUTFILE a+]
#puts "ok - MATCH $line"
puts $chan "$line"
close $chan
}
}
send -- "exit\r"
expect eof
Here is my output
$ cat voip_status.log
ActivationStatus : Enabled
2021-03-17_11:32:35tus : Up
ActivationStatus : Enabled
2021-03-17_11:32:35tus : Up
As you can see that time stamp has overwritten the line I had filtered out.
I wanted timestamp to appear at the end of line .
Why is this happening ?
Here I made an experimental setup which anybody can run to see this behaviour.
Contents of 'output-voice-log-for-experiment.sh' follow
[file to give input]
#!/usr/bin/perl
print "
Account 0:
-----------
ActivationStatus : Enabled
VoipServiceStatus : Up
CallStatus : Idle
Associated LineInst : 1
PhysEndpt : 0
Extension : 122
DisplayName :
AuthName : 122
AuthPwd : 0000
TxGain : 0 dB
RxGain : 0 dB
CALLFEATURES:
MWI : off
Caller ID number : on
Caller ID name : on
CallWaiting : on
CFWDNum :
CallFwdAll : off
CallFwdBusy : off
CallFwdNoans : off
AnonymousOutgoingCall: off
AnonymousCallRcvBlock: off
DoNotDisturb : off
CallCompOnBusy : off
SpeedDial : off
WarmLine : off
WarmLineNum :
CallBarring : off
CallBarringMode : None
CallBarringPin : 9999
CallBarringDigitMap :
NetPrivacy : on
CODECSETTINGS:
VAD : on
pTime : 20
CodecList : (0) G.711MuLaw
(1) G.711ALaw
(2) G.723.1
(3) G.726_16
(4) G.726_24
(5) G.726_32
Account 1:
-----------
ActivationStatus : Enabled
VoipServiceStatus : Up
CallStatus : Idle
Associated LineInst : 2
PhysEndpt : 1
Extension : 121
DisplayName :
AuthName : 121
AuthPwd : 0000
TxGain : 0 dB
RxGain : 0 dB
CALLFEATURES:
MWI : off
Caller ID number : on
Caller ID name : on
CallWaiting : on
CFWDNum :
CallFwdAll : off
CallFwdBusy : off
CallFwdNoans : off
AnonymousOutgoingCall: off
AnonymousCallRcvBlock: off
DoNotDisturb : off
CallCompOnBusy : off
SpeedDial : off
WarmLine : off
WarmLineNum :
CallBarring : off
CallBarringMode : None
CallBarringPin : 9999
CallBarringDigitMap :
NetPrivacy : on
CODECSETTINGS:
VAD : on
pTime : 20
CodecList : (0) G.711MuLaw
(1) G.711ALaw
(2) G.723.1
(3) G.726_16
(4) G.726_24
(5) G.726_32
> exit
"
[/file to give input]
Contents of 'process-experimental-echo.sh' follow
[file to process input]
#!/usr/bin/expect -f
spawn ./output-voice-log-for-experiment.sh
set timeout 20
set OUTFILE "experimental_voip_status.log"
expect ">"
set voice_full_output $expect_out(buffer)
set voice_stat_lines [ split $voice_full_output "\n" ]
foreach line $voice_stat_lines {
if {[string match "*VoipServiceStatus*" $line]} {
set timestamp [timestamp -format %Y-%m-%d_%H:%M:%S]
set chan [open $OUTFILE a+]
puts "ok - MATCH $line"
puts $chan "$line $timestamp"
close $chan
}
if {[string match "*ActivationStatus*" $line]} {
set chan [open $OUTFILE a+]
puts "ok - MATCH $line"
puts $chan "$line"
close $chan
}
}
[/file to process input]
Now simply run ./process-experimental-echo.sh and see this behaviour yourself.
Here is the output file you will get
$ cat experimental_voip_status.log
ActivationStatus : Enabled
2021-03-17_12:27:11tus : Up
ActivationStatus : Enabled
2021-03-17_12:27:11tus : Up
Thanks.
If you look at the output file using cat -vet it shows the non-printing control characters, tabs, and end-of-line, and you get:
ActivationStatus : Enabled^M$
VoipServiceStatus : Up^M 2021-03-17_09:02:53$
You can see ^M in the middle of a line, which is carriage-return. On a terminal this makes the cursor go back to the start of the line, and start overprinting.
This is the typical result of spawn, which runs a command through a pty, which alters each output newlines into carriage-return and newline. This is normal and desired for a pty. You can either turn it off (see stty -onlcr), or knowing that it is likely to be there, you can remove it in your script: after the foreach ... line, trim the variable $line to remove \r:
set line [string trimright $line "\r"]

TimeoutException when trying to connect to Azure service bus queue through informatica

I am trying to load 2k records on azure service bus queue through informatica, but getting timeout exception. The connection is working file for 700 records, successfully loading on queue.
I have created JMS and JNDI connection and is working fine if number of records are less.
Error:
2020-05-04 23:27:28 : ERROR : (3084 | WRITER_1__1) : (IS | PC_INT_EE_QA) : node01_lxinfaeeqa1 : JAVA PLUGIN_1762 : [ERROR] JMS writer encountered a JMS exception: Timed out while waiting to get credit to sendException Stack: javax.jms.JMSException: Timed out while waiting to get credit to send
at org.apache.qpid.amqp_1_0.jms.impl.MessageProducerImpl.send(MessageProducerImpl.java:331)
at com.informatica.powerconnect.jms.server.writer.JMSMessageWriter$QueueWriter.writeMessage(JMSMessageWriter.java:93)
at com.informatica.powerconnect.jms.server.writer.JMSWriterPartitionDriver.execute(JMSWriterPartitionDriver.java:401)
Linked Exception Stack: java.util.concurrent.TimeoutException
at org.apache.qpid.amqp_1_0.transport.ConnectionEndpoint.waitUntil(ConnectionEndpoint.java:1232)
at org.apache.qpid.amqp_1_0.transport.SessionEndpoint.waitUntil(SessionEndpoint.java:686)
at org.apache.qpid.amqp_1_0.transport.LinkEndpoint.waitUntil(LinkEndpoint.java:360)
at org.apache.qpid.amqp_1_0.client.Sender.send(Sender.java:320)
at org.apache.qpid.amqp_1_0.jms.impl.MessageProducerImpl.send(MessageProducerImpl.java:321)
at com.informatica.powerconnect.jms.server.writer.JMSMessageWriter$QueueWriter.writeMessage(JMSMessageWriter.java:93)
at com.informatica.powerconnect.jms.server.writer.JMSWriterPartitionDriver.execute(JMSWriterPartitionDriver.java:401)
.
2020-05-04 23:27:28 : ERROR : (3084 | WRITER_1__1) : (IS | PC_INT_EE_QA) : node01_lxinfaeeqa1 : JAVA PLUGIN_1762 : [ERROR] at com.informatica.powerconnect.jms.server.writer.JMSWriterPartitionDriver.execute(JMSWriterPartitionDriver.java:431)
2020-05-04 23:27:28 : ERROR : (3084 | WRITER_1__1) : (IS | PC_INT_EE_QA) : node01_lxinfaeeqa1 : SDKS_38502 : Plug-in #300800's target [Target_jms: Partition 1] failed in method [execute].
2020-05-04 23:27:28 : INFO : (3084 | WRITER_1__1) : (IS | PC_INT_EE_QA) : node01_lxinfaeeqa1 : WRT_8333 : Rolling back all the targets due to fatal session error.
2020-05-04 23:28:28 : INFO : (3084 | WRITER_1__1) : (IS | PC_INT_EE_QA) : node01_lxinfaeeqa1 : WRT_8325 : Final rollback executed for the target [Target_jms] at end of load
2020-05-04 23:28:28 : ERROR : (3084 | WRITER_1__1) : (IS | PC_INT_EE_QA) : node01_lxinfaeeqa1 : WRT_8081 : Writer run terminated. [Error in loading data to target table [Target_jms: Partition 1]]
2020-05-04 23:28:28 : INFO : (3084 | WRITER_1__1) : (IS | PC_INT_EE_QA) : node01_lxinfaeeqa1 : WRT_8168 : End loading table [Target_jms: Partition 1] at: Mon May 04 13:58:28 2020
2020-05-04 23:28:28 : INFO : (3084 | WRITER_1__1) : (IS | PC_INT_EE_QA) : node01_lxinfaeeqa1 : WRT_8035 : Load complete time: Mon May 04 13:58:28 2020
Appreciate the help.
The queue size for azure was 1GB but it seems that Azure service bus queue can only accept 100 messages in one transaction. I was able to solve the issue by changing the properties at informatica session level.
Commit type to "Target"
commit interval to "100"
And in target properties kept the JMS priority to 9.

kprobe_events fetch-args works for x86 but not arm64

I wanted to get do_sys_open filename argument as string. For this i added kprobe following kprobetrace.txt. A simple probe which gives filename as hex works for both x86/arm64.
x86: echo 'p:myprobe do_sys_open filename_string=%si' > kprobe_events
arm64: echo 'p:myprobe do_sys_open filename_string=%x1' > kprobe_events
However changing probe to get string for file name works on x86 but not arm64(ie cannot get string representation filename_string=(fault))
x86:
echo 'p:myprobe do_sys_open filename_string=+0(%si):string' > kprobe_events
output:
adb-30551 [001] d... 4570187.407426: myprobe: (do_sys_open+0x0/0x270) filename_string="/dev/bus/usb/001/001"
arm64:
echo 'p:myprobe do_sys_open filename_string=+0(%x1):string' > kprobe_events
output:
netd-4621 [001] d... 8491.094187: myprobe: (do_sys_open+0x0/0x24c) filename_string=(fault)
To check if i was using arm ABI correctly i tried setting probe using perf.
The probe created by perf as seen from /sys/kernel/debug/tracing/kprobe_events was similar
./perf4.14 probe 'do_sys_open filename:string'
/d/tracing # cat kprobe_events
p:kprobes/myprobe do_sys_open filename_string=+0(%x1):string
But perf probe was also failing (ie filename_string="") in this case.
./perf4.14 record -e probe:do_sys_open -aR sleep 3
/data/local/tmp # ./perf4.14 script
perf4.14 4587 [007] 7490.809036: probe:do_sys_open: (ffffff8337060148) filename_string=""
sleep 4588 [003] 7490.817937: probe:do_sys_open: (ffffff8337060148) filename_string=""
What would be the correct way to set kprobe_events for arm to fetch args as string?
Am i using the ABI incorrectly?
On kernel version >= 4.20, you can use $argN to fetch the Nth function argument. From kernel 4.20 kprobetrace.rst:
FETCHARGS : Arguments. Each probe can have up to 128 args.
.....
.....
$argN : Fetch the Nth function argument. (N >= 1) (\*1)
Since the filename is second argument of do_sys_open(), you should give $arg2 in the kprobe event, like this:
echo 'p:myprobe do_sys_open filename_string=+0($arg2):string' > kprobe_events
This should work on both x86 and arm64.

print values at fixed position in Terminal window using UNIX

I am running a shell script which produces below output.
Built-By : apache
Created-By : Apache Maven
Implementation-Title : testApp
Implementation-Vendor-Id : com.test.app
Implementation-Version : testBox
Manifest-Version : 1.0
appname : TestStar
build-date : 02-03-2014-13 : 41
version : testBox
Expecting the below output: (Please ignore _ underscore)
Built-By_________________: apache
Created-By_______________: Apache Maven
Implementation-Title_____: testApp
Implementation-Vendor-Id_: com.test.app
Implementation-Version___: testBox
Manifest-Version_________: 1.0
appname__________________: TestStar
build-date_______________: 02-03-2014-13 : 41
version__________________: testBox
Someone Please help me. I am iterating two arrays to print these values.
show me your code.
maybe this would help:
#!/bin/bash
key=("appname" "version" "Created-By")
value=("TestStar" "testBox" "Apache Maven")
for i in "${!key[#]}";do
printf "%-15s %s\n" "${key[i]}" "${value[i]}"
done

Resources