[nix-shell:~/s]$ git clone https://github.com/davispuh/gear-emu # Downloads the latest from github
[nix-shell:~/s]$ cd gear-emu/
[nix-shell:~/s/gear-emu]$ xbuild /p:Configuration=Release # The magic (yet deprecated) incantation.
>>>> xbuild tool is deprecated and will be removed in future updates, use msbuild instead <<<<
XBuild Engine Version 14.0
Mono, Version 5.8.0.108
Copyright (C) 2005-2013 Various Mono authors
Build started 11/4/2018 9:43:41 PM.
__________________________________________________
Project "/home/red/s/gear-emu/gear.sln" (default target(s)):
Target ValidateSolutionConfiguration:
⋮
Microsoft (R) Visual C# Compiler version 2.3.2.61928 (ec1cde8b)
Copyright (C) Microsoft Corporation. All rights reserved.
Target _CopyDeployFilesToOutputDirectoryPreserveNewest:
Creating directory '/home/red/s/gear-emu/Gear/bin/Release/Resources'
⋮
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:06.0526560
[nix-shell:~/s/gear-emu]$ mono Gear/bin/Release/Gear.exe
I tried this (some days ago) and my builds on Debian9/amd64 failed with:
(((lots of similar lines omitted)))
CSC: error CS0518: The predefined type `System.IntPtr' is not defined or imported
CSC: error CS0518: The predefined type `System.UIntPtr' is not defined or imported
CSC: error CS0518: The predefined type `System.RuntimeFieldHandle' is not defined or imported
CSC: error CS0518: The predefined type `System.RuntimeTypeHandle' is not defined or imported
CSC: error CS0518: The predefined type `System.Exception' is not defined or imported
0 Warning(s)
31 Error(s)
Time Elapsed 00:00:02.3771650
There may be some "libraries" missing but not knowing much more about DotNet than just its name I'm lost there.
$ LANG= aptitude search '~i ^mono*' | cat # piping yields terminal width independent output format
i A mono-4.0-gac - Mono GAC tool (for CLI 4.0)
i A mono-csharp-shell - interactive C# shell
i mono-devel - Mono development tools
i A mono-gac - Mono GAC tool
i A mono-mcs - Mono C# 2.0 / 3.0 / 4.0 / 5.0 compiler for CLI 2.0 / 4.0 / 4.5
i A mono-runtime - Mono runtime - default version
i A mono-runtime-common - Mono runtime - common files
i A mono-runtime-sgen - Mono runtime - SGen
i A mono-xbuild - MSBuild-compatible build system for Mono
I simply assumed, installing `mono-devel` would depend on all necessary stuff. :-(
Some minutes later while looking at the head of the log...
XBuild Engine Version 14.0
Mono, Version 4.6.2.0
Copyright (C) 2005-2013 Various Mono authors
results in a `Gear.exe` binary that starts but crashes wile loading a `*.binary`.
That was my status quo 2 days ago.
I really just poke around aimlessly in the Mono universe.
Please laugh later...
Yes - it crashes for me here too. The older version attached to the first post however does work.
[red@apophenia:~/projects/sp]$ mono /nix/store/mnb5wfkawlmskabfzykgxavd6f34k0sw-gear-emu-2015-07-14/bin/Gear.exe
Gtk not found (missing LD_LIBRARY_PATH to libgtk-x11-2.0.so.0?), using built-in colorscheme
System.NullReferenceException: Object reference not set to an instance of an object
at Gear.GUI.SpinView.Repaint (System.Boolean force) [0x000c2] in <8b5bab8ab7a24c02aa57663778500dfc>:0
at Gear.GUI.SpinView.OnSize (System.Object sender, System.EventArgs e) [0x0004c] in <8b5bab8ab7a24c02aa57663778500dfc>:0
at (wrapper delegate-invoke) <Module>.invoke_void_object_EventArgs(object,System.EventArgs)
at System.Windows.Forms.Control.OnSizeChanged (System.EventArgs e) [0x00026] in <8254e6010dae4d09ac0767af6dcc75af>:0
at System.Windows.Forms.Control.UpdateBounds (System.Int32 x, System.Int32 y, System.Int32 width, System.Int32 height, System.Int32
clientWidth, System.Int32 clientHeight) [0x000da] in <8254e6010dae4d09ac0767af6dcc75af>:0
at System.Windows.Forms.Control.UpdateBounds (System.Int32 x, System.Int32 y, System.Int32 width, System.Int32 height) [0x0004a] in
<8254e6010dae4d09ac0767af6dcc75af>:0
at System.Windows.Forms.Control.SetBoundsCoreInternal (System.Int32 x, System.Int32 y, System.Int32 width, System.Int32 height, Syst
em.Windows.Forms.BoundsSpecified specified) [0x00110] in <8254e6010dae4d09ac0767af6dcc75af>:0
at System.Windows.Forms.Control.SetBoundsCore (System.Int32 x, System.Int32 y, System.Int32 width, System.Int32 height, System.Windo
ws.Forms.BoundsSpecified specified) [0x00000] in <8254e6010dae4d09ac0767af6dcc75af>:0
at System.Windows.Forms.Control.SetBoundsInternal (System.Int32 x, System.Int32 y, System.Int32 width, System.Int32 height, System.W
indows.Forms.BoundsSpecified specified) [0x00058] in <8254e6010dae4d09ac0767af6dcc75af>:0
at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control.SetBoundsInternal(int,int,int,int,System.Windows.Forms.BoundsSp
ecified)
at System.Windows.Forms.Layout.DefaultLayout.LayoutDockedChildren (System.Windows.Forms.Control parent, System.Windows.Forms.Control
[] controls) [0x001c6] in <8254e6010dae4d09ac0767af6dcc75af>:0
at System.Windows.Forms.Layout.DefaultLayout.Layout (System.Object container, System.Windows.Forms.LayoutEventArgs args) [0x00013] i
n <8254e6010dae4d09ac0767af6dcc75af>:0
at System.Windows.Forms.Control.OnLayout (System.Windows.Forms.LayoutEventArgs levent) [0x0006d] in <8254e6010dae4d09ac0767af6dcc75a
f>:0
at System.Windows.Forms.ScrollableControl.OnLayout (System.Windows.Forms.LayoutEventArgs levent) [0x00013] in <8254e6010dae4d09ac076
7af6dcc75af>:0
at System.Windows.Forms.ContainerControl.OnLayout (System.Windows.Forms.LayoutEventArgs e) [0x00000] in <8254e6010dae4d09ac0767af6dc
c75af>:0
at System.Windows.Forms.Control.PerformLayout (System.Windows.Forms.Control affectedControl, System.String affectedProperty) [0x0005
a] in <8254e6010dae4d09ac0767af6dcc75af>:0
at System.Windows.Forms.Control.PerformLayout () [0x00000] in <8254e6010dae4d09ac0767af6dcc75af>:0
at Gear.GUI.SpinView.InitializeComponent () [0x003ee] in <8b5bab8ab7a24c02aa57663778500dfc>:0
at Gear.GUI.SpinView..ctor (Gear.EmulationCore.PropellerCPU chip) [0x00030] in <8b5bab8ab7a24c02aa57663778500dfc>:0
at (wrapper remoting-invoke-with-check) Gear.GUI.SpinView..ctor(Gear.EmulationCore.PropellerCPU)
at Gear.GUI.Emulator..ctor (System.String source) [0x0006a] in <8b5bab8ab7a24c02aa57663778500dfc>:0
at (wrapper remoting-invoke-with-check) Gear.GUI.Emulator..ctor(string)
at Gear.GUI.GearDesktop.OpenBinaryButton_Click (System.Object sender, System.EventArgs e) [0x00057] in <8b5bab8ab7a24c02aa5766377850
0dfc>:0
at System.Windows.Forms.ToolStripItem.OnClick (System.EventArgs e) [0x00019] in <8254e6010dae4d09ac0767af6dcc75af>:0
at System.Windows.Forms.ToolStripButton.OnClick (System.EventArgs e) [0x00017] in <8254e6010dae4d09ac0767af6dcc75af>:0
at System.Windows.Forms.ToolStripItem.HandleClick (System.Int32 mouse_clicks, System.EventArgs e) [0x00029] in <8254e6010dae4d09ac07
67af6dcc75af>:0
at System.Windows.Forms.ToolStripItem.FireEvent (System.EventArgs e, System.Windows.Forms.ToolStripItemEventType met) [0x00054] in <
8254e6010dae4d09ac0767af6dcc75af>:0
at (wrapper remoting-invoke-with-check) System.Windows.Forms.ToolStripItem.FireEvent(System.EventArgs,System.Windows.Forms.ToolStrip
ItemEventType)
at System.Windows.Forms.ToolStrip.OnMouseUp (System.Windows.Forms.MouseEventArgs mea) [0x00048] in <8254e6010dae4d09ac0767af6dcc75af
>:0
at System.Windows.Forms.Control.WmLButtonUp (System.Windows.Forms.Message& m) [0x00078] in <8254e6010dae4d09ac0767af6dcc75af>:0
at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x001b4] in <8254e6010dae4d09ac0767af6dcc75af>:0
at System.Windows.Forms.ScrollableControl.WndProc (System.Windows.Forms.Message& m) [0x00000] in <8254e6010dae4d09ac0767af6dcc75af>:
0
at System.Windows.Forms.ToolStrip.WndProc (System.Windows.Forms.Message& m) [0x00000] in <8254e6010dae4d09ac0767af6dcc75af>:0
at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <8254e6010dae4d09ac0767
af6dcc75af>:0
at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x0000b] in <8254e6010dae4d09ac0767af
6dcc75af>:0
at System.Windows.Forms.NativeWindow.WndProc (System.IntPtr hWnd, System.Windows.Forms.Msg msg, System.IntPtr wParam, System.IntPtr
lParam) [0x00085] in <8254e6010dae4d09ac0767af6dcc75af>:0
I know nothing about C# with leaves us with three options.
i. Find a C#/.net guru.
ii. bisect/blame the codebase until we find the offending change.
iii. Stick to the released version above.
Hello!
First of all I want to greet you for interest on use Gear Emulator.
Keeping in mind that you are trying to compile in Linux with mono, I can tell you I never was successful on that. It compiled ON WINDOWS with mono.
The main reason 4 years ago was the System.Windows.Forms class was not ported to linux, working only in Win*. That class is the main application framework of the app.
Maybe the mono project had ported it?
How do I view what is going on with the variables?
Is there an op code to look for in the Memory/Spin map?
Is there a specific place in memory the variables are placed?
When compiled, are the variables given a sequential number as a name or a random one?
Is there a way to get them to show so I can watch them change?
I read thru the "Changes and corrections-ASB.txt" and ran across this.
+Show Cog RAM Special Purpose Registers values.
Now the values of special registers in cog memory (between $1F0 - PAR and $1FF - VSCL)
are displayed correctly in memory or PASM view.
What is PASM view? Where is it? How do you switch it on?
I have stated multiple time I am a beginner with the propeller, microcontrollers in general.
To me the questions are totally different.
If something I am asking is redundant, I don't know that.
There will always be newbies.
This is why the forum is here (supposedly), to share and have it archived for future access, right!?
I read the manual, searched this and other forums, then I asked the questions.
Sorry, but I can not visualize it the way it is described in the manual.
'' Copyright (c) 2008 Philip C. Pilgrim
'' (See end of file for terms of use.)
''
''-----------[ Description ]----------------------------------------------------
''
'' This Propeller object provides up to eight leading-edge-aligned PWM channels
'' with resolution determined by a defined constant. The maximum PWM frequency
'' is the lesser of:
''
'' clkfreq / (13.5 * resolution) and 20.648881 / resolution MHz
''
'' The minimum PWM frequency is :
''
'' clkfreq / (40000 * resolution)
''
'' PWM output is generated using the Propeller's video generator in VGA mode. The
'' eight or fewer channels can be any subset of the pins in one of four
'' contiguous blocks: A0-A7, A8-A15, A16-A23, or A24-A31.
''
''-----------[ History ]--------------------------------------------------------
''
'' Version 1.1: 17 Jul 08: Fixed a couple bugs related to base pins > 0.
'' Version 1.2: 20 Jan 10: Fixed a bug relating to duty modes of 256 (i.e. full on).
''
''-----------[ Program ]--------------------------------------------------------
CON
resolution = 256 'The number of steps in the pulse widths. Must be an integer multiple of 4.
nlongs = resolution / 4
VAR
long fcb[5]
long pwmdata[nlongs + 1]
long pinmask
long previndex[8]
byte cogno, basepin
'-----------[ Public Methods ]-------------------------------------------------
PUB start(base, mask, freq)
' This method is used to setup the PWM driver and start its cog. If a driver had
' already been started, it will be stopped first. The arguments are as follows:
'
' base: The base pin of the PWM output block. Must be 0, 8, 16, or 24.
'
' mask: The enable mask for the eight pins in the block:
'
' bit 0 = basepin + 0
' bit 1 = basepin + 1
' ...
' bit 7 = basepin + 7
'
' Set a bit to 1 to enable the corresponding pin for PWM ouput.
'
' freq: The frequency in Hz for the PWM output.
'
' Returns true on success; false, if no cog is available or parameters exceed
' permissible limits.
if (cogno)
stop
freq *= resolution
if (clkfreq =< 4000000 or freq > 20648881 or clkfreq < freq * 135 / 10 or clkfreq / freq > 40000 or base <> base & %11000 or mask <> mask & $ff or resolution <> resolution & $7ffffffc)
return false
basepin := base
pinmask := mask << base
longfill(@pwmdata, 0, nlongs)
longfill(@previndex, 0, 8)
fcb[0] := nlongs
fcb[1] := freq
fcb[2] := constant(1 << 29 | 1 << 28) | base << 6 | mask
fcb[3] := pinmask
fcb[4] := @pwmdata
if (cogno := cognew(@pwm, @fcb) + 1)
return true
else
return false
PUB stop
' This method is used to stop an already-started PWM driver. It returns true if
' a driver was running; false, otherwise.
if (cogno)
cogstop(cogno - 1)
cogno~
return true
else
return false
PUB duty(pinno, value) | vindex, pindex, i, mask, unmask
' This method defines a pin's duty cycle. It's arguments are:
'
' pinno: The pin number of the PWM output to modify.
'
' value: The new duty cycle (0 = 0% to resolution = 100%)
'
' Returns true on success; false, if pinno or value is invalid.
if (1 << pinno & pinmask == 0 or value < 0 or value > resolution)
return false
pinno -= basepin
mask := $01010101 << pinno
unmask := !mask
vindex := value >> 2
pindex := previndex[pinno]
if (vindex > pindex)
repeat i from pindex to vindex - 1
pwmdata[i] |= mask
elseif (vindex < pindex)
repeat i from pindex to vindex + 1
pwmdata[i] &= unmask
pwmdata[vindex] := pwmdata[vindex] & unmask | mask & ($ffffffff >> (31 - ((value & 3) << 3)) >> 1)
previndex[pinno] := vindex
return true
DAT
' PWM driver loaded into a separate cog. Cycles continuously through PWM data in hub RAM,
' using the video driver to output logic levels.
'-----------[ Initialization ]-------------------------------------------------
org 0
pwm rdlong clkfrq,#0 'Read the current clock frequency (Hz).
mov ptr0,par 'Get beginning address of fcb in ptr0.
rdlong longs,ptr0 'Get the number of longs in pwm array.
add ptr0,#4
rdlong pllfrqh,ptr0 'Read the desired output pll frequency (Hz).
add ptr0,#4 'Increment fcb index.
mov pllfrql,pllfrqh 'Divide output pll freq by 16 to get input pll freq w/ no divider.
shr pllfrqh,#4 ' 64-bit result.
shl pllfrql,#28
mov plldiv,#0 'Initialize frequency divider for no division.
:frqalp cmp pllfrqh,_4000000 wc 'Is input pll freq at least 4MHz?
if_nc jmp #gotpllinp ' Yes: Use it.
shl pllfrql,#1 wc ' No: Input pll freq *= 2.
rcl pllfrqh,#1
add plldiv,#1 ' Divider *= 2 also to keep output the same.
jmp #:frqalp ' Back for another try.
gotpllinp mov ra,pllfrqh 'frqa := input pll freq * 2^32 / clkfrq
mov rb,pllfrql
mov rx,clkfrq
call #divabx 'rb := ra:rb / rx
mov frqa,rb 'Save frqa.
sub plldiv,#7 wc,wz 'Can all the division be done in counter?
if_nz_and_nc jmp #:needvscl
neg plldiv,plldiv ' Yes: Compute the divider value.
jmp #:gotdiv
:needvscl shl vscl0,plldiv ' No: Shift VSCL value left by divider amount.
mov plldiv,#0 ' Set CTRA for maximum divider.
:gotdiv mov vscl,vscl0 'Write computed value to VSCL.
shl plldiv,#23 'Position it for CTRA.
or plldiv,ctra0 'OR in the rest.
mov ctra,plldiv 'Write CTRA.
rdlong vcfg,ptr0 'Get VCFG from fcb.
add ptr0,#4
rdlong dira,ptr0 'Get DIRA from fcb.
add ptr0,#4
rdlong ptr0,ptr0 'Get address of pwmdata array in ptr0.
'-----------[ Main PWM Loop ]--------------------------------------------------
pwmlp mov ptr,ptr0 ' 4 Point back to beginning of pwmdata.
mov ctr,longs ' 4 Initialize counter with no. of longs.
:nyblp rdlong pwmbits,ptr '22 Read four "pixels" form pwmdata.
add ptr,#4 ' 4 Point to next four.
waitvid pwmbits,#%11_10_01_00 ' 6 Wait and "display".
djnz ctr,#:nyblp ' 8 Back for next "pixel".
jmp #pwmlp ' 4 Back for first "pixel".
'---
'52 clocks worst case, or 1.538 MHz through loop w/ 80 MHz clock.
'-----------[ Divide 64 / 32 = 32 ]--------------------------------------------
divabx mov cctr,#32 wc
:loop rcl rb,#1 wc
rcl ra,#1 wc
if_c sub ra,rx
if_nc cmpsub ra,rx wc
djnz cctr,#:loop
rcl rb,#1 wc
divabx_ret ret
'-----------[ Predefined variables and constants ]-----------------------------
vscl0 long 1 << 12 | 4 'Initial VSCL w/ no division.
ctra0 long %00001 << 26 'Initial CTRA w/ no PLL.
pwmbits long 0 '
_4000000 long 4000000 'Minimum PLL input frequency.
'-----------[ Variables ]------------------------------------------------------
ptr0 res 1
ptr res 1
ctr res 1
ra res 1
rb res 1
rx res 1
cctr res 1
clkfrq res 1
pllfrqh res 1
pllfrql res 1
plldiv res 1
longs res 1
''-----------[ TERMS OF USE ]---------------------------------------------------
''
'' Permission is hereby granted, free of charge, to any person obtaining a copy of
'' this software and associated documentation files (the "Software"), to deal in
'' the Software without restriction, including without limitation the rights to use,
'' copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
'' Software, and to permit persons to whom the Software is furnished to do so,
'' subject to the following conditions:
''
'' The above copyright notice and this permission notice shall be included in all
'' copies or substantial portions of the Software.
''
'' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
'' INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
'' PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
'' HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
'' OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
'' SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Comments
Or add the hints to Gear's readme at GitHub?
^^ success!@
Saw that coming :P Glad you got it working nicely done
Some minutes later while looking at the head of the log... Maybe there's a fresher Mono in backports? So "stable-backports" has no fresher stuff.
Trying weird stuff like results in a `Gear.exe` binary that starts but crashes wile loading a `*.binary`.
That was my status quo 2 days ago.
I really just poke around aimlessly in the Mono universe.
Please laugh later...
Admittedly I have not attempted to load a .binary yet. Let me see what I can do...
I know nothing about C# with leaves us with three options.
i. Find a C#/.net guru.
ii. bisect/blame the codebase until we find the offending change.
iii. Stick to the released version above.
It looks like some serious refactoring was done between 947fa1ba and 1378cd81. ERR, in the context above means that mono was unable to compile it.
At the end of said refactoring, it crashes after loading a binary.
Nix has packages for versions of mono:
I can write a quick script to compile the current master under each of these versions and test it (in case the GUI api has changed underneath it).
I guess this tells us that this isn't a mono versioning problem.
Maybe we can ping @Gatuno?
:-(
Can't help: My MonoDevelop crashes faster than I can find the debugger in it.
First of all I want to greet you for interest on use Gear Emulator.
Keeping in mind that you are trying to compile in Linux with mono, I can tell you I never was successful on that. It compiled ON WINDOWS with mono.
The main reason 4 years ago was the System.Windows.Forms class was not ported to linux, working only in Win*. That class is the main application framework of the app.
Maybe the mono project had ported it?
Mono is like a foreign parallel dimension to me, but I see something packaged n Debian9 that "smells" like a "System.Windows.Forms" package.
As I read on https://www.mono-project.com/docs/gui/winforms/ now it would be possible to compile.
There is a interesting "Guide Porting Winforms Applications" - https://www.mono-project.com/docs/gui/winforms/porting-winforms-applications/, with some assistant.
I hope I have been helpful.
I'll update once I have those dependancies resolved.
How do I view what is going on with the variables?
Is there an op code to look for in the Memory/Spin map?
Is there a specific place in memory the variables are placed?
When compiled, are the variables given a sequential number as a name or a random one?
Is there a way to get them to show so I can watch them change?
Thank You
What is PASM view? Where is it? How do you switch it on?
Thank You
Will this naked DAT block compile?
Where is a loop in there?
Am I too undercaffeinated (totally possible!) to see it?
To:yeti
I have stated multiple time I am a beginner with the propeller, microcontrollers in general.
To me the questions are totally different.
If something I am asking is redundant, I don't know that.
There will always be newbies.
This is why the forum is here (supposedly), to share and have it archived for future access, right!?
I read the manual, searched this and other forums, then I asked the questions.
Sorry, but I can not visualize it the way it is described in the manual.
For me, this fragment does not even compile.
Enter code.
F8.
Click Object_info.
Click Save Binary File.
Open Gear.
Click Open Binary.