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

Compatibility with micro:bit v2 #3

Closed
microbit-sam opened this issue Nov 18, 2020 · 13 comments · Fixed by microsoft/pxt-microbit#3992
Closed

Compatibility with micro:bit v2 #3

microbit-sam opened this issue Nov 18, 2020 · 13 comments · Fixed by microsoft/pxt-microbit#3992

Comments

@microbit-sam
Copy link

Hi @mu-opensource,

As you might have seen from microsoft/pxt-microbit#3506 this extension is currently not compiling against the latest version of Micro:bit CODAL. This means it will not work with micro:bit V2.

Software for micro:bit V2 boards is built using CODAL rather than the DAL, and no longer includes the mbed layer. We’ve implemented the most frequently used mbed classes to support easy porting of existing extensions, but there may still be corner cases with this compatibility layer.

As your extension is currently not building, it will be disabled for micro:bit V2. People attempting to use your extension with a micro:bit V2 board will get error 929. This extension will only be re-enabled on micro:bit V2 once it is fixed.

There are details on how to ensure extensions work on both version of the micro:bit here (lancaster-university/codal-microbit-v2#31).

Looking at your extension source I believe that your extension falls under this category:

Use of mbed APIs that are not included in the compatibility layer, or microbit-dal APIs that need different constructors

/home/build/prjclone/pxtapp/CruiseBit/mu_vision_sensor_uart_hw_interface.h:21:9: error: 'MicroBitSerial' does not name a type

MicroBitSerial compatibility is still being looked at and updates will be tracked here

@microbit-pauline
Copy link

@ShiquanYu - Are you able to look at this issue?

@tianli
Copy link
Contributor

tianli commented Jan 9, 2021

Hi, Pauline

I will take a look at this issue and attempt to fix. However, the link to MicroBitSerial compatibility points to a 404 page. Please update if possible.

@microbit-pauline
Copy link

@microbit-sam Is the 404 error something that you are able to look at?

@microbit-sam
Copy link
Author

That link should be to lancaster-university/codal-microbit-v2#31, which it looks like you've already found @tianli

MicroBitSerial should now be defined in CODAL, so this extension might compile. I've not checked yet and am not able to do so right now, so if it still throws errors please let me know and we can investigate

@tianli
Copy link
Contributor

tianli commented Apr 18, 2021

@microbit-sam Our extension compiled but shows 927 when download to a MicroBit V2. Could you confirm if MicroBitSerial is working or it simply disabled in MicroBit V2?

@tianli
Copy link
Contributor

tianli commented Apr 18, 2021

@microbit-sam Our extension compiled but shows 927 when download to a MicroBit V2. Could you confirm if MicroBitSerial is working or it simply disabled in MicroBit V2?

I just disabled all the MicroBitSerial in the code, can you take a look if this will resolve the 927 problem? Thank you!

@microbit-sam
Copy link
Author

Hi @tianli
To get MakeCode to start picking up and compiling your extension for V2, please can you create a tagged release and update this line in pxt-microbit, replacing dv:mbcodal with the new tag. min:{tag}

https://github.com/microsoft/pxt-microbit/blob/9ecf6ffabc18ffe0caf2bac0c96eadadc13ccf74/targetconfig.json#L249

Hope that's clear! Thanks

@tianli
Copy link
Contributor

tianli commented Apr 20, 2021

Thanks @microbit-sam
I already created a tagged release v1.2.21. When following your link and trying to edit the file. I got a "You must be on a branch to make or propose changes to this file" error. My question is, which branch shall I switch to in order to edit that file? Shall I edit it on the master branch?

Thank you!

@microbit-sam
Copy link
Author

You will have to fork the repository and create a new branch to edit the file, and then submit a pull request for the MakeCode team to accept

I can do this for you if you want

@tianli
Copy link
Contributor

tianli commented Apr 21, 2021

That's great, please help me do that. Thank you!

@tianli
Copy link
Contributor

tianli commented Apr 21, 2021

@microbit-sam please help me do that, thank you!

@tianli
Copy link
Contributor

tianli commented Apr 25, 2021

@microbit-sam Sorry to bother you again, do you know why the build failed? It looks like a dependency issue for 'pxt-microbit'?

npm ERR! code ETARGET
npm ERR! notarget No matching version found for pxt-core@6.13.23.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of 'pxt-microbit'
npm ERR! notarget

@tianli
Copy link
Contributor

tianli commented Apr 26, 2021

@microbit-sam I updated release v1.2.21 to include a few fixes. It seems that this statement
" If you use any other part of mbed than those listed above, the quickest option is to move to the CODAL APIs right away, either using #ifdef mbcodal to make V2 specific code, or using the microbit-dal API that is common to V1 and V2."
in lancaster-university/codal-microbit-v2#31
is no longer correct as "mbcodal" is not defined.

After trial-and-error, I was able to use
#if MICROBIT_CODAL
to tell apart v1 and v2 hardware.

The code now fully compiles and I updated release v1.2.21. Please try to build again and it should work now.

Thanks!.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants