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

Use building on Mac M1 - code error #59

Open
2e0wkw opened this issue Mar 5, 2025 · 7 comments
Open

Use building on Mac M1 - code error #59

2e0wkw opened this issue Mar 5, 2025 · 7 comments

Comments

@2e0wkw
Copy link

2e0wkw commented Mar 5, 2025

Hi, I am compiling the code on a Mac Mini M1 and i get the following errors

[ 30%] Building C object CMakeFiles/pico-WSPRer.dir/WSPRbeacon/WSPRbeacon.c.o
/Users/eric/pico-WSPRer/WSPRbeacon/WSPRbeacon.c: In function 'WSPRbeaconTxScheduler':
/Users/eric/pico-WSPRer/WSPRbeacon/WSPRbeacon.c:322:48: error: passing argument 1 of 'sleep_goto_sleep_until' from incompatible pointer type [-Wincompatible-pointer-types]
322 | sleep_goto_sleep_until(&alarm_time, &sleep_callback); //blocks here during sleep perfiod
| ^~~~~~~~~~~
| |
| datetime_t *
In file included from /Users/eric/pico-WSPRer/WSPRbeacon/WSPRbeacon.c:12:
/Users/eric/pico-extras/src/rp2_common/pico_sleep/include/pico/sleep.h:77:46: note: expected 'struct timespec *' but argument is of type 'datetime_t *'
77 | void sleep_goto_sleep_until(struct timespec *ts, aon_timer_alarm_handler_t callback);
| ~~~~~~~~~~~~~~~~~^~
make[2]: *** [CMakeFiles/pico-WSPRer.dir/WSPRbeacon/WSPRbeacon.c.o] Error 1
make[1]: *** [CMakeFiles/pico-WSPRer.dir/all] Error 2
make: *** [all] Error 2

Can you advise please.

@EngineerGuy314
Copy link
Owner

I don't think the problem has anything to do with using a Mac. Looking through your error, it seems that Raspberry Pi made a change to the pico-extras repo (changed datetime_t to timespec). Everyone always says how great it is to "leverage shared open-source components". And it is, until they make a tiny change and screw you over.

An immediate but annoying solution is to checkout an older version of the pico-extras. It seems the offending change to the pico_sleep function was made on Nob 8, 2024 by peterharperuk.

Or I can figure out how to change my program to work with the new structure, but that will screw over anyone that is currently able to compile it, until they update their pico-extras to the current one.

3rd, I might be able to remove all references to pico_sleep from my program and sidestep the whole issue. (pico_sleep was used for a low-power battery mode, which doesn't work anymore anyway because of other changes I had to make to the PLL oscillator stuff).

I will push an update to the repo today that removes the pico_sleep references. Please let me know if it compiles for you. Thank you.

@EngineerGuy314
Copy link
Owner

interesting, I updated pico-extras on my system, and I now get warnings related to the datetime_t/timespec issue, but they are only warnings, not errors.

I guess something about gcc on a Mac is more strict than on PC?

Regardless, I just pushed an update to the repo with all the sleep stuff removed (since it wasn't working anyway).

Please let me know if you can now compile it. Thanks.

@2e0wkw
Copy link
Author

2e0wkw commented Mar 6, 2025

HI, yes it compiles now but it does not run on my Pico. The pre-built one does run. I will work with this for now.

@EngineerGuy314
Copy link
Owner

EngineerGuy314 commented Mar 6, 2025

yes it compiles now but it does not run on my Pico.

Could you share some more details on that?

So you can compile it without warnings or errors, and it does produce a .uf2 file?

Please let me know what if any pattern blinks on the LED after it boots with your .uf2 file. Or if you connect to the serial port with putty or whatever as soon as possible after boot what messages are shown there?

@2e0wkw
Copy link
Author

2e0wkw commented Mar 6, 2025

Hi, yes i compile with no errors or warnings and it does produce a .uf2 file but when i copy that over to the pi pico I just get a rapidly flashing LED and it doesn't open up the serial device so i cannot connect to the device to access the menu (I am still waiting for my GPS to arrive)

@EngineerGuy314
Copy link
Owner

the rapidly flashing LED indicates that it does not see serial comms from the GPS module. But it seems like you don't have the GPS module wired in yet, so thats expected.

But the mystery then is how you are able to run with the pre-built .uf2 file. Even without a GPS module you should be able to interrupt the blinking and access the user setup menu via serial port.

But maybe the issue is that when you compile on your MAC the resultant .uf2 isn't including something needed for the USB-serial port function on the pico. So maybe something in your CmakeLists.txt or other compiler settings needs to be changed? I have no experience with MACs, and only very little with cmake, so I am not the right guy to solve that problem...

@EngineerGuy314
Copy link
Owner

this sounds like a stupid suggestion, but unplug the pico and plug it into a different USB port. This sometimes fixes similar problems in windows, by forcing the system to re-enumerate ports or somesuch.

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

No branches or pull requests

2 participants