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

Pi Pico port improvements #1050

Closed
wants to merge 5 commits into from
Closed

Conversation

veremenko-y
Copy link
Contributor

* /dev/tty1 is not fully blocking console for kput
* /dev/tty2-5 can be configured as independent USB ttys
    * USB ttys operate through a small ring-buffer to minimize
      dropouts at high rate of transmission
* NAND flash (as block device) can be disabled in config to save 7KB of RAM
* /dev/pico device can be used to trigger reboot into flash mode.
  See utils/rpi script
* Trimmed pico SDK to save 5KB of RAM
* Patched ps to report number of used blocks (4KB) per process
* Misc fix of makeversion.c to prevent overflow

    * /dev/tty1 is not fully blocking console for kput
    * /dev/tty2-5 can be configured as independent USB ttys
        * USB ttys operate through a small ring-buffer to minimize
          dropouts at high rate of transmission
    * NAND flash (as block device) can be disabled in config to save 7KB of RAM
    * /dev/pico device can be used to trigger reboot into flash mode.
      See utils/rpi script
    * Trimmed pico SDK to save 5KB of RAM
    * Patched ps to report number of used blocks (4KB) per process
    * Misc fix of makeversion.c to prevent overflow
@veremenko-y
Copy link
Contributor Author

@davidgiven
Pinging you to help with the review.
One thing that I'm not sure about is handling of interrupts. I had issues with deadlocks, and I think adding udata.u_ininterrupt to timer_tick_cbhelped, but I'm not sure if that's 100% correct, as I never fully track the deadlock down.

@veremenko-y
Copy link
Contributor Author

veremenko-y commented Mar 31, 2024

I can't reproduce this build error locally

/usr/include/newlib/sys/_timeval.h:42:18: error: conflicting types for 'time_t'
   42 | typedef _TIME_T_ time_t;

I'm building with the newer version of newlib though. What do you want me to do in this case? E.g. leave it, or should I get an ubuntu VM and ensure it builds there as well?

Name            : arm-none-eabi-newlib
Version         : 4.4.0.20231231-1

}

void device_init(void)
{
kprintf("Unallocated RAM: %dkB\n", UNUSEDSIZE / 1024);

/* The flash device is too small to be useful, and a corrupt flash will
Copy link
Contributor

Choose a reason for hiding this comment

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

Wait, is this true? Shouldn't there be like 1.5MB free on the flash?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm... I don't think Github clearly shows which line you're reviewing.
If you're talking about the comment, I didn't leave it..

As for Unallocated RAM, it's specifically for RAM, not flash. I tried to remove static allocation of userspace memory in swapper.c (e.g. char progbase[USERMEM];) but had issues with Pico hard faulting, and I'm new to arm to track it down, and I'm leaving it for later. So instead I just left myself a reminder for the case where USERMEM can be increased because there's unallocated space before stack bank.

@@ -28,9 +28,9 @@ void plt_reboot(void)

void plt_monitor(void)
{
sleep_ms(1); // wait to print any remaining messages
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed the sleep here, because plt_monitor could be called from interrupt.
The reason I added it is for kernel to print panic properly, but now tty1 is fully blocking.

@EtchedPixels
Copy link
Owner

Can we split this up a bit. It's very hard to navigate all the bits that do differing things.

  1. Fix cleanups and Makefiles
  2. The USB serial changes
  3. The flash device disable (which btw you can do far more easily by simply not registering it in the first place)
  4. The ps changes
  5. SDK trim
  6. Makeversion changes

For the extra device I think it would be better to instead define CONFIG_DEV_PLATFORM at which point misc dev minor 6 ioctls call plt_dev_ioctl to implement any platform specific stuff that doesn't fit anywhere else. Eg the COCO3 port uses it for hooking SWI2/3 for emulating Flex and OS/9 stuff.

@veremenko-y
Copy link
Contributor Author

Absolutely. I got a bit carried away with the changes. I'll split and push them as separate PRs.

For the extra device I think it would be better to instead define CONFIG_DEV_PLATFORM

This is the part of the change I wasn't sure about. Thank you for the info. I'll rewrite the device portion.

@veremenko-y veremenko-y closed this Apr 2, 2024
@veremenko-y veremenko-y mentioned this pull request Apr 6, 2024
@veremenko-y veremenko-y deleted the pipico branch April 15, 2024 18:17
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 this pull request may close these issues.

3 participants