Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler multi threading support #2240

Merged
merged 437 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
437 commits
Select commit Hold shift + click to select a range
c459983
Extend examples, fix Dictionary bugs
pgrawehr May 2, 2021
43ad122
Make sure EqualityComparer..cctors are sorted first
pgrawehr May 2, 2021
5833e50
Remove function - no intrinsic required
pgrawehr May 2, 2021
332fc0c
Another comparison to improve startup sequence anticipation
pgrawehr May 2, 2021
138f337
Code cleanup
pgrawehr May 2, 2021
f94da1e
These tests are to big to be run from RAM
pgrawehr May 2, 2021
c4b05af
Extended example works
pgrawehr May 3, 2021
a27dce1
Support communication via WiFi
pgrawehr May 8, 2021
bb1e538
Disable unused gas sensor
pgrawehr May 8, 2021
046c3e0
Add humidity sensor measurement
pgrawehr May 9, 2021
3838f8d
Extend the example
pgrawehr May 10, 2021
e3b3812
Add implementation of Number.ToString() to library, for debugging pur…
pgrawehr May 10, 2021
606c5cb
Sort unsigned, so that binary search works
pgrawehr May 12, 2021
059aae5
Add dew point
pgrawehr May 15, 2021
47ba4e8
Start adding File I/O support
pgrawehr May 19, 2021
a9b8a75
Broken Weather stuff
pgrawehr May 19, 2021
bc24078
Intermediate commit
pgrawehr May 20, 2021
6a6ee60
Next intermediate commit
pgrawehr May 20, 2021
46ee69a
File system support additions
pgrawehr May 27, 2021
225d2e4
Further work on file system support
pgrawehr May 29, 2021
132d555
Partial file system support
pgrawehr May 30, 2021
ff17f55
Moves to FirmataCommandSequence
pgrawehr Jun 6, 2021
cd55b87
Revert "Moves to FirmataCommandSequence"
pgrawehr Jun 11, 2021
73174cf
File system support for ESP32 almost working
pgrawehr Jun 16, 2021
a783199
Basic support for exception handling added
pgrawehr Jun 26, 2021
38ae7ba
Use common constants
pgrawehr Jul 6, 2021
fa305f8
Write as ASCII
pgrawehr Jul 14, 2021
ffa18e8
Remove wrong warnings
pgrawehr Jul 19, 2021
79a0bcb
Convert List to Dictionary
pgrawehr Jul 19, 2021
734b79a
Support for frequency measurement using Arduino
pgrawehr May 30, 2021
2c8f054
Add infrastructure to add extended command handlers
pgrawehr Jun 5, 2021
19eaa27
Move DHT support to extension module
pgrawehr Jun 6, 2021
c4aa791
Move frequency measurement support to separate module
pgrawehr Jun 6, 2021
243c118
Message reply handling fixed
pgrawehr Jun 6, 2021
937bb0f
Ensure a disposed instance doesn't cause any harm here
pgrawehr Jun 6, 2021
c3c0a92
Fix command sequence for DisableFrequencyReporting
pgrawehr Jul 11, 2021
ee142ed
Change ID for FREQUENCY_COMMAND
pgrawehr Jul 17, 2021
491446b
Make sure the pin mode is set
pgrawehr Aug 3, 2021
ec0f141
Allow setting/getting the internal mode from clients
pgrawehr Aug 3, 2021
2a5770c
Merge remote-tracking branch 'remotes/origin/GenericCommandHandlerSup…
pgrawehr Aug 16, 2021
ff40beb
Fix unit test
pgrawehr Aug 16, 2021
259e344
Fix missing documentation
pgrawehr Aug 17, 2021
f57fad3
Review findings addressed
pgrawehr Aug 25, 2021
3fab03d
Fix a problem when connecting to an Arduino Uno
pgrawehr Aug 28, 2021
33abd06
Avoid static member and use ReaderWriterLockSlim
pgrawehr Sep 3, 2021
01ed14d
Minor review comments
pgrawehr Sep 19, 2021
7c383ed
Recursion is not required
pgrawehr Oct 10, 2021
4ab9c7b
Merge remote-tracking branch 'remotes/origin/GenericCommandHandlerSup…
pgrawehr Oct 10, 2021
b99dc25
Start moving compiler specific stuff to separate tool executable
pgrawehr Oct 10, 2021
d10a9d5
Move most code to ArduinoCsCompiler.cs project
pgrawehr Oct 10, 2021
15b4d93
Compiles again (mostly)
pgrawehr Oct 10, 2021
b818858
Tests appear to run again
pgrawehr Oct 10, 2021
867c1d4
Rename namespace of application
pgrawehr Oct 11, 2021
e45d410
Properly separated out compiler tests as well
pgrawehr Oct 11, 2021
cf91cd7
Tests run, but there's some exception throwing bug
pgrawehr Oct 13, 2021
b19cebb
Fix problem accessing message field of exception class
pgrawehr Oct 15, 2021
bb7d052
These are used, so re-add
pgrawehr Oct 15, 2021
3f6c8b0
Improve test stability
pgrawehr Oct 15, 2021
6a8449a
Add unit tests for overflow instructions
pgrawehr Oct 17, 2021
f95311b
Generate numbers for native methods automatically
pgrawehr Oct 23, 2021
0968213
Re-Add continuous numbering
pgrawehr Oct 23, 2021
59260e4
Added missing source files
pgrawehr Oct 23, 2021
4e64277
Extend exception test cases
pgrawehr Oct 24, 2021
c81d9a1
First working version of compiler frontend.
pgrawehr Oct 25, 2021
30c7488
Execution result is same as in unit test
pgrawehr Oct 25, 2021
cb5e3e4
Fix log level filtering
pgrawehr Oct 27, 2021
447d836
Fix missing method exception
pgrawehr Oct 27, 2021
55429b5
Initial debugging framework
pgrawehr Oct 30, 2021
8cdefad
First working single-step debugger
pgrawehr Oct 31, 2021
7c4fb5c
Message flow in receiver cleaned up
pgrawehr Nov 1, 2021
ec1395b
Searching for a synchronization problem
pgrawehr Nov 7, 2021
8616f3c
Replies ordered by queue to prevent missing one
pgrawehr Nov 7, 2021
f46c54b
WeatherStation sample runs again
pgrawehr Nov 9, 2021
c8095a9
Use abbreviated month names, full names may not fit
pgrawehr Nov 10, 2021
859e28d
Improve I2C bus scan speed
pgrawehr Nov 13, 2021
05b4fad
Improve stability on poor connections
pgrawehr Nov 13, 2021
a521dcb
Moved advanced bus scan support to extension class
pgrawehr Nov 13, 2021
0f16051
Add example for color-fading an RGB LED using three PWM channels
pgrawehr Nov 18, 2021
7f495a7
Send sequence at once
pgrawehr Nov 29, 2021
49ee317
Extend timeout to work around issue https://github.com/espressif/ardu…
pgrawehr Dec 4, 2021
bf08345
Fix array size increase
pgrawehr Dec 4, 2021
9a4d830
Introduce sequence number in IL commands
pgrawehr Dec 4, 2021
e3308b0
Allow sending some commands as Sequence
pgrawehr Dec 5, 2021
7fc74a2
Intermediate commit
pgrawehr Dec 8, 2021
6895f51
Add unit test
pgrawehr Dec 9, 2021
fd7a1b8
Added more ExceptionHandling tests
pgrawehr Dec 11, 2021
96c3713
Add support for handling system exceptions
pgrawehr Dec 13, 2021
210607f
Run only one test at once
pgrawehr Dec 14, 2021
c96db32
Add a test for a bug handling a LEAVE instruction
pgrawehr Dec 14, 2021
3087d29
Merge remote-tracking branch 'remotes/dotnet/main' into DebuggerSupport
pgrawehr Dec 15, 2021
71a3c7b
Fix merge issues, now builds against .NET 6.0
pgrawehr Dec 15, 2021
e764056
Improve stability of WeatherStation example
pgrawehr Dec 17, 2021
7b47781
Started to adapt runtime components to new framework
pgrawehr Dec 18, 2021
9738853
Code execution now at least begins with .NET6.0
pgrawehr Dec 18, 2021
1e0e5c9
Introduced new EquatableMethod class, to make sure method equality al…
pgrawehr Dec 19, 2021
9a49d95
The first tests run again, but they use to much memory
pgrawehr Dec 19, 2021
0c6ccab
Exception tests run again
pgrawehr Dec 20, 2021
2f3a12b
Existing unit tests work
pgrawehr Dec 25, 2021
948cb7c
Intermediate commit
pgrawehr Dec 25, 2021
470c7ef
Some api implementations and declarations
pgrawehr Dec 26, 2021
b6321d0
The WeatherStation sample compiles again
pgrawehr Dec 26, 2021
36b0aca
Prepare for optimizing duplicate generic implementations
pgrawehr Dec 27, 2021
d71a665
Can merge some generic implementations
pgrawehr Dec 28, 2021
b053694
Also need a manual implementation of FieldInfo.Equals
pgrawehr Dec 28, 2021
961b637
Move compiler specifics to Compiler
pgrawehr Dec 28, 2021
dbdc7f8
Compiles, but is still to big.
pgrawehr Dec 29, 2021
277255a
Some compatibility improvements
pgrawehr Dec 30, 2021
ea0f25b
Interop.Kernel32 is automatically replacing all instances of this class
pgrawehr Jan 7, 2022
3d4a7f7
Add a missing index test
pgrawehr Jan 7, 2022
4a6c3cb
Debugger significantly extended
pgrawehr Jan 8, 2022
a33213e
Bug fix starting the main method with arguments
pgrawehr Jan 8, 2022
95088d8
My WeatherStation stample runs in simulation
pgrawehr Jan 9, 2022
59e54e3
The debugger is able to show locals, arguments and the evaluation sta…
pgrawehr Jan 11, 2022
bfff285
Fix crash
pgrawehr Jan 14, 2022
e031347
Send static vector size, and fix some initializers using the PrivateI…
pgrawehr Jan 16, 2022
5690a0b
We can initialize the root vector for the static fields initially
pgrawehr Jan 18, 2022
b189e32
Fix a missing initializer value
pgrawehr Jan 18, 2022
72d11c5
Write out enums with correct size
pgrawehr Jan 19, 2022
6638b17
Fix regression introduced by using a common function
pgrawehr Jan 19, 2022
8cfc039
Include tests and runtime data writing in frontend
pgrawehr Jan 22, 2022
eeabbf6
Add new interactive test mode
pgrawehr Jan 22, 2022
ad16fd3
Create dotnet-desktop.yml
pgrawehr Jan 22, 2022
1925b72
Update dotnet-desktop.yml
pgrawehr Jan 22, 2022
d4ffba2
Merge pull request #82 from pgrawehr/CreateArduinoBuild
pgrawehr Jan 22, 2022
4b2784b
Update existing pipeline file instead of new one
pgrawehr Jan 27, 2022
1dc6aa2
Use a batch file instead of complex yaml
pgrawehr Jan 28, 2022
f17a0c2
Merge remote-tracking branch 'remotes/dotnet/main' into ArduinoCsPr
pgrawehr Jan 29, 2022
ff3b7fb
Fix minor build issues
pgrawehr Jan 29, 2022
7196d76
These tests should not run during normal build
pgrawehr Jan 29, 2022
42a11ac
Running on a single CPU should show the test errors
pgrawehr Jan 29, 2022
e70484e
Use newer image, maybe this has .NET 6.0 preinstalled
pgrawehr Jan 29, 2022
c942830
At least getting to the relevant step now
pgrawehr Jan 29, 2022
c84a8a3
Should get ESP32 build to run now
pgrawehr Jan 29, 2022
83779f3
A few more steps
pgrawehr Jan 29, 2022
abd97d3
In the IDE, the build passes, so we can't be that far off
pgrawehr Jan 30, 2022
043ff8b
Now gluing everything together
pgrawehr Jan 31, 2022
d6b7e42
Need to bring msbuild into the path
pgrawehr Jan 31, 2022
416e46d
Where is msbuild?
pgrawehr Jan 31, 2022
f24c700
Visual Studio Enterprise is installed, therefore change path
pgrawehr Jan 31, 2022
d340293
Restart build
pgrawehr Feb 1, 2022
1abfca3
Need the ESP32 core v2.0.2 or later
pgrawehr Feb 1, 2022
8869ea3
Add a missing library dependency
pgrawehr Jan 22, 2022
dd32e2d
Be a bit more verbose on the long running tests
pgrawehr Feb 1, 2022
59a2be0
Use of a BlockingCollection when waiting for ACKs
pgrawehr Feb 2, 2022
f9b6f77
Building with /maxCpuCount:1 on Windows and Linux
pgrawehr Feb 2, 2022
af481ed
Add ping command to measure round-trip time
pgrawehr Jan 26, 2022
71a2ab2
Extend timeout and publish results (test)
pgrawehr Feb 3, 2022
cefd829
The pipeline computers are still to slow
pgrawehr Feb 3, 2022
542bfeb
File renamed
pgrawehr Feb 4, 2022
091932f
Start with some tests for localization support
pgrawehr Feb 4, 2022
fed769b
Take timezone information from system
pgrawehr Feb 7, 2022
e10647a
Fix crash when debugger shows arguments of non-static method
pgrawehr Feb 8, 2022
16f77d9
Improve map file output
pgrawehr Feb 8, 2022
391bf1e
First attempt to calculate alignments
pgrawehr Feb 9, 2022
2c6afa1
First part of getting time zone from system
pgrawehr Feb 13, 2022
12a0225
Time zone support appears to finally work
pgrawehr Feb 13, 2022
978db81
Trim message when it ends with CR+LF
pgrawehr Feb 14, 2022
e4588cd
Try to support a second, local culture
pgrawehr Feb 14, 2022
341150e
Allow selecting a culture via command line
pgrawehr Feb 14, 2022
6475720
Support localized date/time/number formats
pgrawehr Feb 15, 2022
cd009ba
Fix a compiler warning
pgrawehr Feb 16, 2022
6c3c4e5
Add weird compiler warning issue
pgrawehr Feb 27, 2022
bb119a2
Start extending the prepare command
pgrawehr Feb 27, 2022
fd1be2b
Merge remote-tracking branch 'remotes/dotnet/main' into ExtendedPrepa…
pgrawehr Feb 27, 2022
4ce450e
Allow creating partition map, prepare improved error handling
pgrawehr Feb 27, 2022
da04ddb
Provide some native implementations, Logging improvements
pgrawehr Feb 27, 2022
09b1484
Working on completing some remaining native functions
pgrawehr Mar 1, 2022
e32171e
Almost the last warnings removed
pgrawehr Mar 2, 2022
4157bd6
GpioDrivers should not be internal
pgrawehr Mar 2, 2022
951c25b
No warnings for WeatherStation sample
pgrawehr Mar 2, 2022
c43e0aa
Improve progress display, prevent progress during CI
pgrawehr Mar 3, 2022
891d87a
Fix implementation of Array.Clear()
pgrawehr Mar 4, 2022
450beec
Fix a problem referencing the correct equality comparer
pgrawehr Mar 5, 2022
5fb3d77
Fix a problem with the size of static fields
pgrawehr Mar 5, 2022
d9be545
Fix partition size alignment to 4k
pgrawehr Mar 6, 2022
bb29286
Make sure test run terminates with error code 0 on success
pgrawehr Mar 6, 2022
24f2940
Minor documentation fix
pgrawehr Mar 11, 2022
fa38450
Merge remote-tracking branch 'remotes/dotnet/main' into ArduinoCsPr
pgrawehr Mar 11, 2022
2e70de4
Add many missing license headers
pgrawehr Mar 11, 2022
2650032
Remove classes only used for testing
pgrawehr Mar 11, 2022
c8f4a6e
Add possibility to limit scan addresses
pgrawehr Mar 17, 2022
14dc48a
Weird: Everything appears to be successful but the task fails
pgrawehr Mar 17, 2022
fcfec26
Fix wrong project name
pgrawehr Mar 19, 2022
2add11b
Start extending WeatherStation sample
pgrawehr Mar 5, 2022
4fa8f18
Introduce new flags for [ThreadStatic]
pgrawehr Mar 19, 2022
b89a7ac
First implementation for threads is working
pgrawehr Mar 20, 2022
331b3ed
The philosophers dinner is almost ready
pgrawehr Mar 20, 2022
5c0fb26
Move sample to subfolder
pgrawehr Mar 20, 2022
188a657
Initial debugger support for secondary threads
pgrawehr Mar 21, 2022
168b97c
Fix logging, extend tests
pgrawehr Mar 23, 2022
17229fc
Extend timeout when debugger attached
pgrawehr Mar 24, 2022
05803d8
Console.WriteLine is unsynchronized
pgrawehr Mar 25, 2022
e305b5a
Add new bit for synchronized methods
pgrawehr Mar 26, 2022
20d00c7
Add some command line parameters, improve comments
pgrawehr Mar 26, 2022
795b778
Partial implementation of TimerQueue, required for the Task scheduler…
pgrawehr Mar 27, 2022
e5f8288
Thread properties done
pgrawehr Mar 28, 2022
e89a6ec
More threading stuff done right
pgrawehr Mar 30, 2022
9e84960
Make (possibly?) event callbacks on the Arduino work
pgrawehr Apr 18, 2022
a34a526
(Temporarily) go back to old version
pgrawehr Apr 23, 2022
0a5df4a
Minor memory improvements
pgrawehr Apr 23, 2022
e3fa03b
Merge remote-tracking branch 'remotes/dotnet/main' into MultiThreading1
pgrawehr Oct 8, 2022
42d0baa
Start sorting out merge conflicts
pgrawehr Oct 8, 2022
fd09bd5
Fix path
pgrawehr Oct 8, 2022
c27b5eb
More merge cleanup - go back closer to main
pgrawehr Oct 9, 2022
ea51e37
Increase data version
pgrawehr Oct 16, 2022
bb40cff
Revert "(Temporarily) go back to old version"
pgrawehr Oct 16, 2022
889280b
Need to improve test case handling
pgrawehr Oct 17, 2022
4700ba4
Fix date pattern
pgrawehr Oct 21, 2022
e2ca292
Fix a potential crash when humidity is 0
pgrawehr Oct 31, 2022
f5b4e4e
Mostly debugging stuff - undo again!
pgrawehr Oct 31, 2022
bbefddd
Ensure the rest of the line is clear when overwriting content
pgrawehr Nov 1, 2022
57dfbdf
Request a reply after a set of write-only transmits
pgrawehr Nov 1, 2022
ebaa56b
Make sure the Clean() call really occurs before a mode switch
pgrawehr Nov 1, 2022
f43b98a
Remove debugging stuff again
pgrawehr Nov 1, 2022
b7e6db8
Support replacing static constructors
pgrawehr Nov 6, 2022
bc0bf78
A bit documentation update
pgrawehr Nov 6, 2022
c2de040
Allow terminating of test application (in PC mode)
pgrawehr Nov 12, 2022
d450938
This should be faster
pgrawehr Nov 12, 2022
dda87dc
Debugger help improved, allow selecting thread for debug
pgrawehr Nov 13, 2022
7c1ee89
Merge remote-tracking branch 'remotes/dotnet/main' into MultiThreading2
pgrawehr Nov 27, 2022
73ab585
File is already in Compiler directory
pgrawehr Nov 27, 2022
05fbb62
Revert wrong changes
pgrawehr Nov 27, 2022
6b7d9d3
Correct parsing of hex numbers
pgrawehr Nov 27, 2022
204ea23
Minor performance improvement
pgrawehr Dec 11, 2022
3938eee
Fix repeatedly enabling and disabling PWM
pgrawehr Dec 22, 2022
9381287
Small test improvement
pgrawehr Dec 25, 2022
365bf6f
Use short message if possible
pgrawehr Dec 25, 2022
ee0db69
Will need a new table for a performance improvement
pgrawehr Dec 25, 2022
53e4a10
Fix behavior of EnumEquals implementation
pgrawehr Jan 8, 2023
aecf3b0
Fix Class sorting
pgrawehr Dec 29, 2022
408ca26
More uncritical changes
pgrawehr Jan 9, 2023
e81d987
Next step, still acceptable memory use
pgrawehr Jan 9, 2023
b46ccc0
Where's the difference?
pgrawehr Jan 9, 2023
97fb605
Still good, now only the UnitsNet update itself can be the culpit?!?
pgrawehr Jan 9, 2023
c8904b6
Update UnitsNet to V5.0
pgrawehr Jan 9, 2023
0fc9143
Merge remote-tracking branch 'remotes/dotnet/main' into UnitsNet5_Sec…
pgrawehr Jan 14, 2023
00790d5
Merge remote-tracking branch 'remotes/dotnet/main' into Compiler_Mult…
pgrawehr Apr 7, 2023
2d5b918
Fix build
pgrawehr Apr 7, 2023
17850de
These new methods are required
pgrawehr Nov 21, 2023
e30b31e
When not starting the debugger, still correctly call the main method
pgrawehr Nov 25, 2023
28755dd
New compiler command group: Exec
pgrawehr Dec 9, 2023
e1ba43a
Logging works in simulation
pgrawehr Dec 10, 2023
b40bd59
Extended WeatherStation almost works
pgrawehr Dec 11, 2023
8d86963
Try to add separate workflow
pgrawehr Dec 16, 2023
c7e1756
Merge remote-tracking branch 'remotes/dotnet/main' into Compiler_Mult…
pgrawehr Dec 16, 2023
d3976a0
Fix merge issues
pgrawehr Dec 16, 2023
cfa8a54
Build the compiler in a separate pipeline
pgrawehr Dec 16, 2023
cfbb403
Markdown errors fixed
pgrawehr Dec 16, 2023
d9cb6e9
Remove now unused job
pgrawehr Dec 17, 2023
57bd477
Undo bad change for commit
pgrawehr Jan 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/arduino.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This is a basic workflow to help you get started with Actions

name: Arduino_Compiler_CI

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events
push:

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
pull_request:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: windows-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Checkout
uses: actions/checkout@master

- run: |
eng/ArduinoCsCI.cmd %USERPROFILE% Debug

26 changes: 4 additions & 22 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ stages:
sourceFolder: $(Build.SourcesDirectory)/artifacts/packages/$(BuildConfiguration)/Shipping
targetFolder: $(Build.ArtifactStagingDirectory)/Packages

- task: PublishTestResults@2
inputs:
mergeTestResults: true

- publish: $(Build.ArtifactStagingDirectory)/Packages
displayName: Publish Build Artifacts
artifact: BuildPackages
Expand All @@ -91,28 +95,6 @@ stages:
displayName: 'Execute markdown-link-check'
condition: eq(variables['build.reason'], 'PullRequest')

# - job: Windows_ArduinoIntegration
# displayName: Arduino Integration Tests
# timeoutInMinutes: 120
# pool:
# vmImage: windows-2022

# strategy:
# matrix:
# Build_Release:
# BuildConfiguration: Release
# Build_Debug:
# BuildConfiguration: Debug

# steps:
# - script: build.cmd -ci
# -configuration $(BuildConfiguration)
# -prepareMachine
# displayName: Build Iot

# - script: eng\ArduinoCsCI.cmd $(UserProfile) $(BuildConfiguration)
# displayName: Build and run Arduino Integration Tests

- job: Linux
displayName: Linux Build
container: LinuxContainer
Expand Down
7 changes: 6 additions & 1 deletion eng/ArduinoCsCI.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ REM Second argument is either "Debug" or "Release"
if %1!==! goto :usage

REM Defines the revision to check out in the ExtendedConfigurableFirmata repo
set FIRMATA_SIMULATOR_CHECKOUT_REVISION=e2cfb5223aeb71e3a0756d67619db6c238b6acb5
set FIRMATA_SIMULATOR_CHECKOUT_REVISION=4a3b895c062c8e48685b9018d642d2c5ea84c354
set RUN_COMPILER_TESTS=FALSE

choco install -y --no-progress arduino-cli
Expand All @@ -16,13 +16,18 @@ arduino-cli config init
arduino-cli config add board_manager.additional_urls https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json
arduino-cli core update-index

REM directly execute PS, we can ignore any test errors.
powershell -ExecutionPolicy ByPass -command "%~dp0common\Build.ps1" -restore -build -ci -configuration %2 -preparemachine

set ArduinoRootDir=%1\Documents\Arduino
set acspath=%~dp0\..\tools\ArduinoCsCompiler\Frontend\bin\%2\net6.0\acs.exe

git clone https://github.com/firmata/ConfigurableFirmata %ArduinoRootDir%\libraries\ConfigurableFirmata
git clone https://github.com/pgrawehr/ExtendedConfigurableFirmata %ArduinoRootDir%\ExtendedConfigurableFirmata
arduino-cli core install esp32:esp32

git fetch --all
git branch --list
REM Check whether any compiler files have changed - if so, enable the (long running) compiler tests
git diff --name-status origin/main | find /C /I "tools/ArduinoCsCompiler"
REM Find returns 1 when the string was NOT found, we want to set the variable to true when it does find something
Expand Down
21 changes: 21 additions & 0 deletions src/devices/Arduino/ArduinoBoard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,27 @@ public void AddCommandHandler<T>(T newCommandHandler)
}
}

/// <summary>
/// Unregisters the given command handler
/// </summary>
/// <typeparam name="T">A type derived from <see cref="ExtendedCommandHandler"/></typeparam>
/// <param name="commandHandler">The instance</param>
/// <remarks>This is intended mostly for unit test scenarios, where the command handlers are recreated. It does not
/// remove the modes supported by the handler</remarks>
public void RemoveCommandHandler<T>(T commandHandler)
where T : ExtendedCommandHandler
{
_commandHandlersLock.EnterWriteLock();
try
{
_extendedCommandHandlers.Remove(commandHandler);
}
finally
{
_commandHandlersLock.ExitWriteLock();
}
}

/// <summary>
/// Gets the command handler with the provided type. An exact type match is performed.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions src/devices/Arduino/FirmataDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ internal sealed class FirmataDevice : IDisposable
private const byte FIRMATA_PROTOCOL_MAJOR_VERSION = 2;
private const byte FIRMATA_PROTOCOL_MINOR_VERSION = 5; // 2.5 works, but 2.6 is recommended
private const int FIRMATA_INIT_TIMEOUT_SECONDS = 2;
internal static readonly TimeSpan DefaultReplyTimeout = TimeSpan.FromMilliseconds(2000);
internal static readonly TimeSpan DefaultReplyTimeout = TimeSpan.FromMilliseconds(3000);

private byte _firmwareVersionMajor;
private byte _firmwareVersionMinor;
Expand Down Expand Up @@ -1209,7 +1209,7 @@ internal void DisableAnalogReporting(int pinNumber, int analogChannel)
pwmCommandSequence.WriteByte((byte)0);
pwmCommandSequence.WriteByte((byte)FirmataCommand.END_SYSEX);
SendCommand(pwmCommandSequence);
}
}
}
}

Expand Down
22 changes: 5 additions & 17 deletions src/devices/CharacterLcd/LcdInterface.I2c4Bit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ private sealed class I2c4Bit : LcdInterface

private readonly I2cDevice _i2cDevice;
private bool _backlightOn;
private int _backlightFlag;

public I2c4Bit(I2cDevice i2cDevice)
{
_i2cDevice = i2cDevice ?? throw new ArgumentNullException(nameof(i2cDevice));
_backlightOn = true;
_backlightFlag = LCD_BACKLIGHT;
InitDisplay();
}

Expand All @@ -44,26 +46,12 @@ public override bool BacklightOn
set
{
_backlightOn = value;
_backlightFlag = value ? LCD_BACKLIGHT : 0;
// Need to send a command to make this happen immediately.
SendCommandAndWait(0);
}
}

private byte BacklightFlag
{
get
{
if (BacklightOn)
{
return LCD_BACKLIGHT;
}
else
{
return 0;
}
}
}

private void InitDisplay()
{
// This sequence (copied from a python example) completely resets the display (if it was
Expand All @@ -89,8 +77,8 @@ public override void SendCommand(byte command)

private void Write4Bits(byte command)
{
_i2cDevice.WriteByte((byte)(command | ENABLE | BacklightFlag));
_i2cDevice.WriteByte((byte)((command & ~ENABLE) | BacklightFlag));
_i2cDevice.WriteByte((byte)(command | ENABLE | _backlightFlag));
_i2cDevice.WriteByte((byte)((command & ~ENABLE) | _backlightFlag));
}

public override void SendCommands(ReadOnlySpan<byte> commands)
Expand Down
6 changes: 6 additions & 0 deletions tools/ArduinoCsCompiler/ArduinoCsCompiler.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,10 @@
<ProjectReference Include="..\..\src\System.Device.Gpio\System.Device.Gpio.csproj" />
</ItemGroup>

<ItemGroup>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>$(AssemblyName).Tests</_Parameter1>
</AssemblyAttribute>
</ItemGroup>

</Project>
9 changes: 9 additions & 0 deletions tools/ArduinoCsCompiler/ArduinoImplementationAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ public bool MergeGenericImplementations
set;
}

/// <summary>
/// Set to true for methods that are only called by the runtime (e.g. thread start callbacks)
/// </summary>
public bool InternalCall
{
get;
set;
}

/// <summary>
/// Computes a hash code for a string that stays consistent over different architectures and between program runs.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions tools/ArduinoCsCompiler/ArduinoMethodDeclaration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ public ArduinoMethodDeclaration(int token, EquatableMethod methodBase, ArduinoMe
Name = $"{MethodBase.MethodSignature()} (Token 0x{Token:X})";
}

public ArduinoMethodDeclaration(int token, EquatableMethod methodBase, ArduinoMethodDeclaration? requestedBy, IlCode code)
public ArduinoMethodDeclaration(int token, EquatableMethod methodBase, ArduinoMethodDeclaration? requestedBy, IlCode code, MethodFlags extraFlags)
{
Index = -1;
MethodBase = methodBase;
RequestedBy = requestedBy;
Code = code;
Flags = MethodFlags.None;
Flags = extraFlags;
Token = token;

var attribs = methodBase.GetCustomAttributes(typeof(ArduinoImplementationAttribute)).Cast<ArduinoImplementationAttribute>().ToList();
Expand Down
53 changes: 52 additions & 1 deletion tools/ArduinoCsCompiler/ClassDeclaration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#pragma warning disable CS1591
namespace ArduinoCsCompiler
{
public class ClassDeclaration
public class ClassDeclaration : IEquatable<ClassDeclaration>
{
private readonly List<ClassMember> _members;
private readonly List<Type> _interfaces;
Expand Down Expand Up @@ -70,6 +70,57 @@ public bool SuppressInit
}
}

public bool Equals(ClassDeclaration? other)
{
if (ReferenceEquals(null, other))
{
return false;
}

if (ReferenceEquals(this, other))
{
return true;
}

// Here, Type and MiniType must be distinct.
return NewToken == other.NewToken && Name == other.Name;
}

public override bool Equals(object? obj)
{
if (ReferenceEquals(null, obj))
{
return false;
}

if (ReferenceEquals(this, obj))
{
return true;
}

if (obj.GetType() != GetType())
{
return false;
}

return Equals((ClassDeclaration)obj);
}

public override int GetHashCode()
{
return NewToken;
}

public static bool operator ==(ClassDeclaration? left, ClassDeclaration? right)
{
return Equals(left, right);
}

public static bool operator !=(ClassDeclaration? left, ClassDeclaration? right)
{
return !Equals(left, right);
}

public void AddClassMember(ClassMember member)
{
if (ReadOnly)
Expand Down
4 changes: 2 additions & 2 deletions tools/ArduinoCsCompiler/CompilerCommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ private bool ParseReply(byte[] data, ExecutorCommand expectedCommand, ref Comman
}
else if (data[2] == (byte)ExecutorCommand.ConditionalBreakpointHit || data[2] == (byte)ExecutorCommand.Variables)
{
_compiler.OnCompilerCallback(data[3] | (data[4] << 7), MethodState.Debugging, data);
_compiler.OnCompilerCallback(data[4] | (data[5] << 7), MethodState.Debugging, data);
}
}
else
Expand Down Expand Up @@ -344,7 +344,7 @@ public void AddMethodDeclarations(IList<FirmataCommandSequence> sequences, int d
{
FirmataIlCommandSequence sequence = new FirmataIlCommandSequence(ExecutorCommand.DeclareMethod);
sequence.SendInt32(declarationToken);
sequence.WriteByte((byte)methodFlags);
sequence.SendUInt14((ushort)methodFlags);
sequence.WriteByte(maxStack);
sequence.WriteByte(argCount);
sequence.SendInt32((int)nativeMethod);
Expand Down
3 changes: 3 additions & 0 deletions tools/ArduinoCsCompiler/CompilerSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public CompilerSettings()
AdditionalSuppressions = new List<string>();
LaunchProgramFromFlash = false;
MaxMemoryUsage = 256 * 1024;
UsePreviewFeatures = false;
}

/// <summary>
Expand Down Expand Up @@ -93,6 +94,8 @@ public bool ForceFlashWrite
set;
}

public bool UsePreviewFeatures { get; set; }

object ICloneable.Clone()
{
return MemberwiseClone();
Expand Down
Loading