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

test pr to run CI #85

Merged
merged 29 commits into from
Mar 26, 2025
Merged

test pr to run CI #85

merged 29 commits into from
Mar 26, 2025

Conversation

pillo79
Copy link

@pillo79 pillo79 commented Mar 20, 2025

No description provided.

KurtE and others added 6 commits March 5, 2025 10:32
Resolves: arduino#51

There is an IO pin on the NANO that that when turned on, enables most of the sensors on the BLE sense which are on SPI1.   The MBED version, enables this pin as part of the main().

Which I am trying to emulate.  There is code already in, that if you use at least one of the zephyr device drivers, will eanble this pin.  However that does not help when you are using external libraries or the like.

So I added details about this pin in our overlay file, in the zephyr,user section.

I then added code to main.cpp, that is only included if your are building using an NRFX board.  Currently the nano and one of the nicla boards.  Could also specically only do this on the NANO, but probably does not
matter as, the code tries to find that property and only if it is found, does it turn on the pin.

Note: The MBED version turn on this pin with high drive.  Which I emulated using the information,
mentioned in the zephyr discussion.
zephyrproject-rtos/zephyr#78710
In one of my sketches I verified that the pin pads configuration looks the same as mbed setup.

With these changes I am able to access most of the sensors.
Most of the testing has been done by @mjs513, with some by myself as well.
Added call to main.cpp to initVariant.
Added a weak version in main.cpp.

Then moved the code for initializing the enable sensor pin out of main.cpp
into the initVariant that I added to variant.cpp for the specific board
resolves: arduino#64

Removed the pins logical Arduino pins 11-13 from the PWM pin list, plus their defines
for the timers.

With these defines in place, the pins Alternate Function settings were set to that of the timers
versus the SPI value (5)

Note: This was done by @mjs513 and myself.
GIGA: Remove Arduino pins 11-13 from PWM list to fix SPI1
@KurtE
Copy link

KurtE commented Mar 21, 2025

Quick notes:
Thought I would play along ;)

I believe I am in sync with the latest change for it... get variant name...

I did west update, build_all.sh, built the post build ...

Tried with simple modified blink sketch

Giga: appears to run, Although this giga still starts up in debug mode (have to type sketch)... And it shows up in the
ports list: ttyACM0

Portenta H7: loads, but still no Serial port (i.e. no ttyACM0)

Portenta C33: loads and like H7 also no serial port.

That is it so far....

pillo79 added 4 commits March 21, 2025 16:27
* origin/fully_linked:
  Arduino.h: fix DIGITAL_PIN_EXISTS macro to avoid comment expansion issues
  gh: test sketch compilation after packaging core
  loader: fix rw612 and ek_ra8
  SerialUSB: create SerialUSB object only if CONFIG_USB_CDC_ACM=y
  core: use the new postbuild tool
  post-build: rework to use empty area in ELF header or add it in binaries
  loader: cleanups
  post-build: refactor to use flag package
  west.yml: use arduino remote
  build.sh: fix shields parameter
  portenta_c33: rebuild loader
  loader: move cache config to be board specific
  usb: start supporting USB_DEVICE_STACK_NEXT
  c33: rebuild loader
  zephyrClient: fix SSL overload
  wip: c33
  wip: linked build
  mass rebuild
  build_all: add c33
  c33: add artifacts
  boards: add portenta c33
  platform: dfu-util: allow skipping dfuse
  c33: fix pwm in loader
  TEMP: get rid of serialEvent
  serial: add missing include
  fixme: add bootloader reflasher for c33
  targets: add portenta c33
  loader: enable USB only for legacy stack
  loader: fix ringbuffer exports
  west.yml: use merged branch
  temp: fix display/camera coexistence
  giga: update branch to support display shield
- generate a _debug.elf, then strip it to create the final .elf
- add '-zsk.bin' extension to the chosen binary so all files end in .bin
- use upload.extension more consistently
@mjs513
Copy link

mjs513 commented Mar 21, 2025

Might as well join the party. Did the same as @KurtE but working in WSL on PC. Am seeing the same things that was mentioned with the exception I am not stuck in debug mode on the GIGA.

Pretty much see
#84
and
#80

@pillo79 pillo79 force-pushed the fully_linked branch 2 times, most recently from 6aafbd3 to 027f7cd Compare March 21, 2025 15:58
@mjs513
Copy link

mjs513 commented Mar 21, 2025

@KurtE - @pillo79 - @facchinm

Just rebuilt core using @pillo79 branch from sketch as well as the bootloader. Seems to be worse.
GIGA: Serial works after updating bootloader and uploading sketch.
H7: No Serial.
Nano 33 Sense: No serial as well.

hope its just me missing something.

@KurtE
Copy link

KurtE commented Mar 22, 2025

@pillo79 @facchinm and @mjs513 - As I mentioned in the issue: #84
I believe I found the issue with USB not working on the H7.

More details on the issue, but short version:

I went into the file /zephyr/boards/arduino/portenta_h7/arduino_portenta_h7_stm32h747xx_m7.dts
Assuming I typed that right and I commented out the line:
/* #include <../boards/common/usb/cdc_acm_serial.dtsi> */

Also needed, added the line: zephyr,uart-mcumgr = &usart6;
to the chosen section of the H7 overlay file. To sort of match what was in GIGA (except 6 instead of 1)

Rebuilt - flashed - and programmed and: ttyACM0 was working again.

Side comment: noticed that the define for platform_board appears to be different? Not sure if intentional, but:
instead of what I was expecting: ARDUINO_PORTENTA_H7
I am now seeing: ARDUINO_ARDUINO_PORTENTA_H7

@mjs513
Copy link

mjs513 commented Mar 22, 2025

As a heads up.
I2C:
Now that we have Serial back I ran a Wire Scanner sketch and found that for the H7 Wire1 and Wire2 were not defined. Going into the H7 overlay found it was still the original overlay file. Also it did not have the abbreviated pin list that @KurtE put together to enable using all the analog pins (think last 2 open PRs). Nor did it have analog or adc enabled. Really outdated. Using our latest overlay for the H7 was Scanner worked on Wire1 and Wire2. Suggest you update your overlay.

Threading:
Ran my semaphore example:

#include <zephyr/random/random.h>
#include "LibPrintf.h"
#include "elapsedMillis.h"
elapsedMillis timer;

#define PRODUCER_STACKSIZE 1024
#define CONSUMER_STACKSIZE 1024

/* STEP 2 - Set the priority of the producer and consumper thread */
#define PRODUCER_PRIORITY 5
#define CONSUMER_PRIORITY 5

/* STEP 9 - Define semaphore to monitor instances of available resource */
K_SEM_DEFINE(instance_monitor_sem, 10, 10);

/* STEP 3 - Initialize the available instances of this resource */
volatile uint32_t available_instance_count = 10;

// Function for getting access of resource
void get_access(void)
{
	/* STEP 10.1 - Get semaphore before access to the resource */
	k_sem_take(&instance_monitor_sem, K_FOREVER);

	/* STEP 6.1 - Decrement available resource */
	available_instance_count--;
	printf("Resource taken and available_instance_count = %d\n", available_instance_count);
}

// Function for releasing access of resource
void release_access(void)
{
	/* STEP 6.2 - Increment available resource */
	available_instance_count++;
	printf("Resource given and available_instance_count = %d\n", available_instance_count);

	/* STEP 10.2 - Give semaphore after finishing access to resource */
	k_sem_give(&instance_monitor_sem);
}

/* STEP 4 - Producer thread relinquishing access to instance */
void producer(void)
{
	Serial.print("Producer thread started\n");
	while (1) {
		release_access();
		// Assume the resource instance access is released at this point
		k_msleep(500 + sys_rand32_get() % 10);
	}
}

/* STEP 5 - Consumer thread obtaining access to instance */
void consumer(void)
{
	Serial.print("Consumer thread started\n");
	while (1) {
		get_access();
		// Assume the resource instance access is released at this point
		k_msleep(sys_rand32_get() % 10);
	}
}

K_THREAD_DEFINE(producer_id, PRODUCER_STACKSIZE, producer, NULL, NULL, NULL, PRODUCER_PRIORITY, 0,
		0);
K_THREAD_DEFINE(consumer_id, CONSUMER_STACKSIZE, consumer, NULL, NULL, NULL, CONSUMER_PRIORITY, 0,
		0);

void setup() {
  Serial.begin(115200);
  while (!Serial && millis() < 5000) {};
  Serial.println("Threading time slice sketch  started");
k_tid_t our_tid = k_sched_current_thread_query();
  int main_pri = k_thread_priority_get(our_tid);
  Serial.print("main TID: ");
  Serial.print((uint32_t)our_tid, HEX);
  Serial.print(" pri: ");
  Serial.println(main_pri);
  printk("main TID:%x pri:%d\n", (uint32_t)our_tid, main_pri);
  //k_thread_priority_set(our_tid, THREAD0_PRIORITY+1);
  //main_pri = k_thread_priority_get(our_tid);
  //Serial.print("\tupdated pri: ");
  //Serial.println(main_pri);
  //printk("main TID:%x pri:%d\n", (uint32_t)our_tid, main_pri);
}

void loop() {
  if(timer > 5000){
    Serial.println("called from loop");
    timer = 0;
  }
  k_msleep(10);
}

gave me a bus fault whereas before it ran without issue. Verified that it ran on the GIGA no issue.

@KurtE
Copy link

KurtE commented Mar 23, 2025

@pillo79 @facchinm @mjs513 - not sure of the best ways of fixing/enhancing this PR.

But what I tried to create a PR against the Arduino branch for zephyr... I accidentally created and then closed it on main project
zephyrproject-rtos/zephyr#87524

I also have fixes for the USB stuff, plus manual merge of our other main PR for fixing the USB on the portenta plus
adding in the other stuff, like: SPI, Wire, Analog pins, PWM, GPIO pins..
This was a manual merge of #82

Was complicated as could not cherry pick or the like as the variant names changed and the like.

I created a new branch based off of this PR:

git fetch pull/85/head:pr_fully_linked
git checkout pr_fully_linked

I made the changes and then pushed it all up to a new temporary branch

https://github.com/KurtE/ArduinoCore-zephyr/tree/pr_fully_linked

So far I tested, that I could upload blink example sketch and Serial port was there.
Tested with simple sketch that prints out loop counter.
Tested with sketch that cycles through the three LEDS by pin names.

@KurtE KurtE mentioned this pull request Mar 23, 2025
@mjs513
Copy link

mjs513 commented Mar 23, 2025

Hmm lost what I initially wrote but...

Sycnched up with @KurtE;s branch as we usually try to stay in synch for testing.

On the Portenta H7 (LITE)

  1. Serial does work with @KurtE change to the h7 dts and to the overlay.
  2. Wire Scanner loads and runs and picks up devices on Wire1.
  3. Looks like threading is working using his branch: thread_create, thread_define, nested mutexs, and semaphores
  4. GC2145 and OV7670 cameras are recognized but keeping getting error on can't set video format - not sure why yet.
  5. SDRAM and qspi sketches are working - however still have questions - see open issues.

On Nano 33 sense

  • Still no com port/ Serial after uploading new firmware.

pillo79 and others added 8 commits March 24, 2025 16:34
Get the variant name (NORMALIZED_BOARD_TARGET) from the Zephyr build
system as early as possible. This allows to have per-target build
directories.

Note that a bug with the shield specifiers does not currently allow to
reuse the same build directory multiple times.

Remove inline comments from macro definitions in include files.
Define a single macro to enable the shell over USB, and use it in the
appropriate places.
Always use the new 'board_cdc_acm_uart' definition for USB CDC ACM
interfaces. This is the new standard for Zephyr serial-over-USB.
@mjs513
Copy link

mjs513 commented Mar 25, 2025

@pillo79 - @KurtE

Tried your lastest changes in pillo79:fully_linked, looks like H7 and GIGA Serial is working. However NANO 33 Sense Serial/USB is still not working. Just thought you would like to know before you do any release.

EDIT: H7 Overlay does not have all I2C ports, Analog, etc. that @KurtE and I had it PRs. Just a note

@KurtE
Copy link

KurtE commented Mar 25, 2025

@pillo79 - @KurtE

However NANO 33 Sense Serial/USB is still not working. Just thought you would like to know before you do any release.

I tried a couple different sketches on an Nano 33 Sense Rev2 this morning, including: the example blink, and before that,
simple one that output look count numbers to the Serial port.

They both failed to run. Hooked up Teeny 4 built as USB to multi Serial adapter and hooked up to NANO serial pins and found:

uart:~$ sketch
[00:00:07.627,380] <err> llext: Undefined symbol with no entry in symbol table __stack_chk_g                                              uard, offset 800, link section 10
[00:00:07.639,587] <err> elf: Could not find symbol __stack_chk_guard!
[00:00:07.646,972] <err> llext: Failed to link, ret -61
Failed to load sketch, rc -61
uart:~$
uart:~$ sketch
[00:00:15.411,041] <err> llext: Undefined symbol with no entry in symbol table __stack_chk_guard, offset 62                               0, link section 10
[00:00:15.423,217] <err> elf: Could not find symbol __stack_chk_guard!
[00:00:15.430,633] <err> llext: Failed to link, ret -61
Failed to load sketch, rc -61
uart:~$

EDIT: H7 Overlay does not have all I2C ports, Analog, etc. that @KurtE and I had it PRs. Just a note
My assumption now is that you probably want to get this PR done before taking on some updates, like the ports and stuff for H7 and C33.

Note: The above runs were done by simply running the stuff you uploaded, in this case I did not rebuild myself.
I also cleared out of the previous variants, boards, ... first

git fetch upstream pull/85/head:new_branch
git checkout new_branch

@facchinm facchinm marked this pull request as ready for review March 26, 2025 17:40
@facchinm facchinm merged commit 2f96a1a into arduino:fully_linked Mar 26, 2025
3 of 4 checks passed
KurtE added a commit to KurtE/ArduinoCore-zephyr that referenced this pull request Mar 27, 2025
This is a replacement for PR: arduino#71 and arduino#82.

All of the earlier commits were squashed into one.  Then this was converted a few times during the arduino#85 pr time
frame as things kept changing and moving around.   It has now been updated to the released .3 version.

I started off adding in the whole pin table as defined by the MBED version, which actually contained duplicate defines.  I later reduced
this set such that it now longer matches the MBED version, but does still include all of the pins that have external pins on some of the
breakout boards. As for compatibility, most of the documentation for these show the PIN names and not numbers, so I imported the
MBED Pin name table and have the start of allowing several different operations to be done, like pinMode, digitalWrite.

We defined the additional SPI ports and Wire ports.

We defined an initial setup for Analog pins.  Have similar hack to GIGA version for pure Analog.  Added additional hacks for duplicated
pins.  That is two of the analog Pins are the exact same pin as some other digital pins...

Added some PWM support.

Also added WIP: camera support.

Co-Authored-By: Mike S <[email protected]>
KurtE added a commit to KurtE/ArduinoCore-zephyr that referenced this pull request Mar 31, 2025
This is a replacement for PR: arduino#71 and arduino#82.

All of the earlier commits were squashed into one.  Then this was converted a few times during the arduino#85 pr time
frame as things kept changing and moving around.   It has now been updated to the released .3 version.

I started off adding in the whole pin table as defined by the MBED version, which actually contained duplicate defines.  I later reduced
this set such that it now longer matches the MBED version, but does still include all of the pins that have external pins on some of the
breakout boards. As for compatibility, most of the documentation for these show the PIN names and not numbers, so I imported the
MBED Pin name table and have the start of allowing several different operations to be done, like pinMode, digitalWrite.

We defined the additional SPI ports and Wire ports.

We defined an initial setup for Analog pins.  Have similar hack to GIGA version for pure Analog.  Added additional hacks for duplicated
pins.  That is two of the analog Pins are the exact same pin as some other digital pins...

Added some PWM support.

Also added WIP: camera support.

Co-Authored-By: Mike S <[email protected]>
KurtE added a commit to KurtE/ArduinoCore-zephyr that referenced this pull request Apr 1, 2025
This is a replacement for PR: arduino#71 and arduino#82.

All of the earlier commits were squashed into one.  Then this was converted a few times during the arduino#85 pr time
frame as things kept changing and moving around.   It has now been updated to the released .3 version.

I started off adding in the whole pin table as defined by the MBED version, which actually contained duplicate defines.  I later reduced
this set such that it now longer matches the MBED version, but does still include all of the pins that have external pins on some of the
breakout boards. As for compatibility, most of the documentation for these show the PIN names and not numbers, so I imported the
MBED Pin name table and have the start of allowing several different operations to be done, like pinMode, digitalWrite.

We defined the additional SPI ports and Wire ports.

We defined an initial setup for Analog pins.  Have similar hack to GIGA version for pure Analog.  Added additional hacks for duplicated
pins.  That is two of the analog Pins are the exact same pin as some other digital pins...

Added some PWM support.

Also added WIP: camera support.

Co-Authored-By: Mike S <[email protected]>
KurtE added a commit to KurtE/ArduinoCore-zephyr that referenced this pull request Apr 3, 2025
This is a replacement for PR: arduino#71 and arduino#82.

All of the earlier commits were squashed into one.  Then this was converted a few times during the arduino#85 pr time
frame as things kept changing and moving around.   It has now been updated to the released .3 version.

I started off adding in the whole pin table as defined by the MBED version, which actually contained duplicate defines.  I later reduced
this set such that it now longer matches the MBED version, but does still include all of the pins that have external pins on some of the
breakout boards. As for compatibility, most of the documentation for these show the PIN names and not numbers, so I imported the
MBED Pin name table and have the start of allowing several different operations to be done, like pinMode, digitalWrite.

We defined the additional SPI ports and Wire ports.

We defined an initial setup for Analog pins.  Have similar hack to GIGA version for pure Analog.  Added additional hacks for duplicated
pins.  That is two of the analog Pins are the exact same pin as some other digital pins...

Added some PWM support.

Also added WIP: camera support.

Co-Authored-By: Mike S <[email protected]>
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.

4 participants