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

Avr #409

Merged
merged 89 commits into from
Oct 4, 2016
Merged

Avr #409

merged 89 commits into from
Oct 4, 2016

Conversation

tballmsft
Copy link
Contributor

  • refactoring to support AVR assembler and Thumb Assembler
  • refactoring of backthumb.ts to backbase.ts, hexfile.ts, backthumb.ts

tballmsft and others added 30 commits August 7, 2016 14:38
# Conflicts:
#	pxtlib/emitter/assembler.ts
#	pxtlib/emitter/thumb.ts
@@ -3240,6 3251,7 @@ cmd("extract [FILENAME] - extract sources from .hex/.jsz file, stdin (
cmd("test - run tests on current package", testAsync, 1)
cmd("gendocs - build current package and its docs", gendocsAsync, 1)
cmd("format [-i] file.ts... - pretty-print TS files; -i = in-place", formatAsync, 1)
cmd("testassembler - test the assemblers", testAssemblers)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to have ,1) or ,2) to hide from simple help

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

// more special characters to handle
if (s.indexOf("@") >= 0) {
m = /^(\w )@(-?\d )$/.exec(s)
if (m) {
if (mul != 1)
this.directiveError(lf("multiplication not supported with saved stacks"));
if (this.stackpointers.hasOwnProperty(m[1]))
// TODO: ARM-specific???
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not ARM-specific

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx

v = 4 * (this.stack - this.stackpointers[m[1]] parseInt(m[2]))
else
this.directiveError(lf("saved stack not found"))
}

// TODO: ARM-specific???
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

specific to CPUs which can only load 8 bit of constant data from an instruction at a time - I think this includes AVR - the @hi and @lo get the first and second byte of the address of label relative to the beginning of the assembly file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx

@@ -390,17 387,14 @@ namespace ts.pxtc.assembler {
if (this.finalEmit)
this.directiveError(lf("unknown label: {0}", name));
else
// Is this a joke?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There needs to be a value here, and in the first emit labels might not be resolved yet. I think there was some reason not to use 0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

// - pop/push receive register sets: { r0, r3, r4 }
// - r0 is the current value (from expression evaluation)
// - also used (fixed) are r1, r2, r5, r6 (what about r3, r4?)
// - registers for runtime calls (r1,r2,r3)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also r0

// - registers are 32-bit (really???)
// - pop/push receive register sets: { r0, r3, r4 }
// - r0 is the current value (from expression evaluation)
// - also used (fixed) are r1, r2, r5, r6 (what about r3, r4?)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r5 is for captured locals in lambda and r6 for globals; it's unclear why not r4 and r5

return r
}

// TODO: generalize and lift out ARM-specific code
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's nothing ARM-specific in this function

@tballmsft tballmsft closed this Oct 4, 2016
@tballmsft tballmsft reopened this Oct 4, 2016
@tballmsft tballmsft merged commit 7dbd6b7 into master Oct 4, 2016
@@ -0,0 1,77 @@
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we already have a "tests" folder, can you move all the /test/avr/ files under there?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong button.

@@ -0,0 1,183 @@
import re
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pxt is fundamentally a JS project. We should avoid adding dependencies to Python. Can this be rewritten in JS instead?

@@ -0,0 1,77 @@
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong button.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants