Skip to content

Conversation

@luoliwoshang
Copy link
Member

@luoliwoshang luoliwoshang commented Sep 10, 2025

problem 1

goplus/llgo#1292

package main

import (
	"fmt"

	"github.com/goplus/lib/emb/machine"
)

func main() {
	buttonPin := machine.GPIO34
	buttonPin.Configure(machine.PinConfig{Mode: machine.PinInput})
	for {
		buttonState := buttonPin.Get()
		fmt.Printf("hello... %t\n", buttonState)
		// time.Sleep(200 * time.Millisecond)
	}
}
llgo run -target esp32-coreboard-v2 .
<unknown>:0: error: Undefined temporary symbol .L�w� 
error: cannot compile inline asm
<unknown>:0: error: Undefined temporary symbol .L �� 
error: cannot compile inline asm
<unknown>:0: error: Undefined temporary symbol .Lxe� 
error: cannot compile inline asm
<unknown>:0: error: Undefined temporary symbol .Ly� 
error: cannot compile inline asm
<unknown>:0: error: Undefined temporary symbol .L{� 
error: cannot compile inline asm
<unknown>:0: error: Undefined temporary symbol .L
error: cannot compile inline asm
<unknown>:0: error: Undefined temporary symbol .L�v� 
error: cannot compile inline asm
<unknown>:0: error: Undefined temporary symbol .L �� 
error: cannot compile inline asm
<unknown>:0: error: Undefined temporary symbol .Lxd� 
error: cannot compile inline asm
<unknown>:0: error: Undefined temporary symbol .Lx� 
error: cannot compile inline asm
<unknown>:0: error: Undefined temporary symbol .Lz� 
error: cannot compile inline asm
<unknown>:0: error: Undefined temporary symbol .L|� 
error: cannot compile inline asm
12 errors generated.
panic: export object of os failed: exit status 1
/Users/zhangzhiyang/Library/Caches/llgo/crosscompile/esp-clang-19.1.2_20250820/bin/clang++ --target=xtensa -mcpu=esp32 -Wno-override-module -Qunused-arguments -Wno-unused-command-line-argument --target=xtensa -Werror -fshort-enums -Wno-macro-redefined -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections -I/Users/zhangzhiyang/Library/Caches/llgo/crosscompile/newlib-esp32-esp-4.3.0_20250211-patch3/newlib/libc/include -I/Users/zhangzhiyang/Library/Caches/llgo/crosscompile/newlib-esp32-esp-4.3.0_20250211-patch3/newlib -I/Users/zhangzhiyang/Library/Caches/llgo/crosscompile/newlib-esp32-esp-4.3.0_20250211-patch3/newlib/libc -o /Users/zhangzhiyang/Library/Caches/go-build/33/33edacd01ab6c13e7915b9c09999000f90636ce32555c935c8a2744272b641d4-d.o -c /var/folders/5j/sgtxqmbn1hbdqtgx5kkp6y700000gn/T/llgo-39290526.ll -Wno-override-module

The asm code can found this error code

/Users/zhangzhiyang/Library/Caches/llgo/crosscompile/esp-clang-19.1.2_20250820/bin/clang++ --target=xtensa -mcpu=esp32 -Wno-override-module -Qunused-arguments -Wno-unused-command-line-argument --target=xtensa -fshort-enums -Wno-macro-redefined -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections -I/Users/zhangzhiyang/Library/Caches/llgo/crosscompile/newlib-esp32-esp-4.3.0_20250211-patch3/newlib/libc/include -I/Users/zhangzhiyang/Library/Caches/llgo/crosscompile/newlib-esp32-esp-4.3.0_20250211-patch3/newlib  -I/Users/zhangzhiyang/Library/Caches/llgo/crosscompile/newlib-esp32-esp-4.3.0_20250211-patch3/newlib/libc -S -o /tmp/test.s /var/folders/5j/sgtxqmbn1hbdqtgx5kkp6y700000gn/T/llgo-39290526.ll -Wno-override-module -Werror -o test.S

error at test.S

	.literal .LCPI136_2940, 32768
	.literal .LCPI136_2941, �o���
	.literal .LCPI136_2942, .L ����
	.literal .LCPI136_2943, .Lx����
	.literal .LCPI136_2944, .L�I���
	.literal .LCPI136_2945, .L�K���
	.literal .LCPI136_2946, .L
	.literal .LCPI136_2947, .L
	.literal .LCPI136_2948, .L�n���
	.literal .LCPI136_2949, .L ����
	.literal .LCPI136_2950, .Lx����
	.literal .LCPI136_2951, �H���
	.literal .LCPI136_2952, .L�J���
	.literal .LCPI136_2953, �L���
	.literal .LCPI136_2954, .L
	.section	.text.os.direntNamePtr,"ax",@progbits
	.global	os.direntNamePtr                # -- Begin function os.direntNamePtr
	.p2align	2
	.type	os.direntNamePtr,@function
os.direntNamePtr:                       # @os.direntNamePtr
# %bb.0:                                # %_llgo_0

problem 2

with goplus/llgo#1286

package main

import (
	"github.com/goplus/lib/emb/machine"
)

func main() {
	buttonPin := machine.GPIO34
	buttonPin.Configure(machine.PinConfig{Mode: machine.PinInput})
	for {
		buttonState := buttonPin.Get()
		println(buttonState)
		// fmt.Printf("hello... %t\n", )
		// time.Sleep(200 * time.Millisecond)
	}
}
ld.lld: warning: /opt/homebrew/Cellar/bdw-gc/8.2.8/lib/libgc.a: archive member 'malloc.c.o' is neither ET_REL nor LLVM bitcode
ld.lld: warning: /opt/homebrew/Cellar/bdw-gc/8.2.8/lib/libgc.a: archive member 'dyn_load.c.o' is neither ET_REL nor LLVM bitcode
ld.lld: warning: /opt/homebrew/Cellar/bdw-gc/8.2.8/lib/libgc.a: archive member 'typd_mlc.c.o' is neither ET_REL nor LLVM bitcode
ld.lld: warning: /opt/homebrew/Cellar/bdw-gc/8.2.8/lib/libgc.a: archive member 'ptr_chck.c.o' is neither ET_REL nor LLVM bitcode
ld.lld: warning: /opt/homebrew/Cellar/bdw-gc/8.2.8/lib/libgc.a: archive member 'mallocx.c.o' is neither ET_REL nor LLVM bitcode
ld.lld: warning: /opt/homebrew/Cellar/bdw-gc/8.2.8/lib/libgc.a: archive member 'gc_dlopen.c.o' is neither ET_REL nor LLVM bitcode
ld.lld: warning: /opt/homebrew/Cellar/bdw-gc/8.2.8/lib/libgc.a: archive member 'pthread_start.c.o' is neither ET_REL nor LLVM bitcode
ld.lld: warning: /opt/homebrew/Cellar/bdw-gc/8.2.8/lib/libgc.a: archive member 'pthread_stop_world.c.o' is neither ET_REL nor LLVM bitcode
ld.lld: warning: /opt/homebrew/Cellar/bdw-gc/8.2.8/lib/libgc.a: archive member 'pthread_support.c.o' is neither ET_REL nor LLVM bitcode
ld.lld: warning: /opt/homebrew/Cellar/bdw-gc/8.2.8/lib/libgc.a: archive member 'darwin_stop_world.c.o' is neither ET_REL nor LLVM bitcode
ld.lld: warning: /opt/homebrew/Cellar/bdw-gc/8.2.8/lib/libgc.a: archive member 'specific.c.o' is neither ET_REL nor LLVM bitcode
ld.lld: warning: /opt/homebrew/Cellar/bdw-gc/8.2.8/lib/libgc.a: archive member 'thread_local_alloc.c.o' is neither ET_REL nor LLVM bitcode
ld.lld: warning: /opt/homebrew/Cellar/bdw-gc/8.2.8/lib/libgc.a: archive member 'gcj_mlc.c.o' is neither ET_REL nor LLVM bitcode
ld.lld: warning: /opt/homebrew/Cellar/bdw-gc/8.2.8/lib/libgc.a: archive member 'fnlz_mlc.c.o' is neither ET_REL nor LLVM bitcode
ld.lld: error: section 'text' will not fit in region 'iram_seg': overflowed by 19527 bytes

with 0Z cflag

problem3

# github.com/goplus/lib/emb/device/arm
interrupts.c: Assembler messages:
interrupts.c:4: Error: no such instruction: `msr PRIMASK,%rdi'
interrupts.c:14: Error: no such instruction: `mrs %rax,PRIMASK'
interrupts.c:15: Error: no such instruction: `cpsid i'

temp remove

@niupilot
Copy link

niupilot bot commented Sep 10, 2025

PR Review: Remove Board Definition Files

Review Progress:

  • Analyze current emb/machine directory structure
  • Review sample removed board definition files
  • Check for remaining references to removed boards
  • Assess documentation consistency
  • Evaluate architectural impact
  • Provide comprehensive review feedback

Critical Issues Found

⚠️ MAJOR CONCERN: This PR removes far more than board definitions. The deletion includes:

  • 119 board definition files (all platforms: Arduino, Pico, STM32, nRF, etc.)
  • Core machine implementation files for multiple architectures
  • Platform-specific drivers (ADC, I2C, SPI, UART, USB, etc.)
  • Essential infrastructure (timers, GPIO, PWM, watchdog, etc.)

Files Deleted: 219 total files from emb/machine/
Files Remaining: Only 65 files, primarily ESP32-related

Specific Problems

1. Misleading Description

The commit message "only keep esp32 flag .go" doesn't accurately describe the scope of changes. This removes entire platform support, not just board definitions.

2. Broken Build Tags

Files like emb/machine/spi.go:1, emb/machine/i2c.go:1, and emb/machine/uart.go:1 still reference deleted platforms:

//go:build !baremetal || atmega || esp32 || fe310 || k210 || nrf || rp2040 || sam || stm32

These will cause build failures for non-ESP32 targets.

3. Missing Impact Assessment

No explanation provided for:

  • Why remove support for major platforms (Arduino, Raspberry Pi Pico, STM32, Nordic nRF, etc.)
  • How users migrating from these platforms should proceed
  • What this means for the ecosystem

4. Documentation Gaps

  • No updates to README or documentation reflecting platform support changes
  • No migration guide for affected users
  • No justification for the architectural decision

Recommendations

🛑 STRONGLY RECOMMEND:

  1. Provide clear rationale for removing multi-platform support
  2. Add migration documentation for users on removed platforms
  3. Fix build tag inconsistencies in remaining files
  4. Consider less destructive alternatives (deprecation notices, separate packages)
  5. Update project documentation to reflect ESP32-only focus

This change fundamentally alters the scope and utility of the library. Please ensure this aligns with project goals and user expectations.

👉 Want me to re-run this review? Just type /review in the comments! For more usage examples, visit CodeAgent GitHub Repository.

@luoliwoshang luoliwoshang marked this pull request as draft September 10, 2025 14:28
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @luoliwoshang, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors the emb/machine directory by eliminating board-specific Go files that do not pertain to ESP32. The change aims to reduce codebase complexity and maintenance overhead by narrowing the scope of supported hardware configurations to only ESP32.

Highlights

  • Codebase Streamlining: Removed numerous board definition files from the emb/machine directory, focusing the codebase on ESP32-related configurations.
  • Reduced Maintenance Overhead: Eliminated a large number of hardware-specific files, simplifying future maintenance and reducing the overall project footprint.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request consists of a massive deletion of board support packages and machine-specific implementations for a wide range of architectures, including AVR, SAM, nRF, STM32, RP2040, and even ESP32 variants. The pull request title, 'only keep esp32 flag .go', is ambiguous and does not align with the removal of ESP32-based board files. The lack of a description makes it impossible to understand the intent behind these sweeping changes. This is a critical issue, as removing support for dozens of boards is a major breaking change that requires a thorough explanation and justification. I strongly recommend providing a detailed description of the motivation for this refactoring and the intended outcome.

@@ -1,125 +0,0 @@
//go:build adafruit_esp32_feather_v2

Choose a reason for hiding this comment

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

critical

The PR title suggests that ESP32 support is being kept, yet this file for an ESP32-based board is being deleted. This is confusing and highlights the need for a clear explanation of the changes in the PR description. Please clarify the strategy for ESP32 board support.

@@ -1,88 +0,0 @@
//go:build pico

Choose a reason for hiding this comment

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

critical

This file, which provides board support for the Raspberry Pi Pico, is being deleted. This PR removes support for a large number of boards across multiple architectures without any explanation. This is a major breaking change. Could you please provide context for this removal in the PR description?

@@ -1,40 +0,0 @@
//go:build arduino

Choose a reason for hiding this comment

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

critical

The deletion of this file removes support for Arduino boards based on the ATmega328P. This is part of a massive removal of board support packages in this PR. A detailed explanation for such a significant and breaking change is necessary in the pull request description.

@@ -1,96 +0,0 @@
//go:build feather_m4

Choose a reason for hiding this comment

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

critical

Removing support for the Adafruit Feather M4 (ATSAMD51) and many other boards is a very significant change. Please add a comprehensive description to this pull request to clarify the reasoning behind these deletions.

@@ -1,105 +0,0 @@
//go:build feather_nrf52840

Choose a reason for hiding this comment

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

critical

This change removes support for the Adafruit Feather nRF52840. Like many other files in this PR, its deletion contributes to a large-scale removal of functionality. It is critical to provide a clear rationale for this in the PR description.

@@ -1,110 +0,0 @@
//go:build bluepill

Choose a reason for hiding this comment

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

critical

The removal of Bluepill (STM32F103) support, along with support for numerous other boards, needs justification. Please update the PR description to explain the purpose of these extensive deletions.

@@ -1,77 +0,0 @@
//go:build nrf || nrf51 || nrf52 || nrf528xx || stm32f4 || stm32l4 || stm32wlx || atsamd21 || atsamd51 || atsame5x || rp2040 || rp2350

Choose a reason for hiding this comment

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

critical

This file, providing a generic flash block device interface, is being removed. Its build constraint covers many of the architectures for which board support is also being removed. The removal of this fundamental interface, along with the board files, suggests a major refactoring or feature removal that is not documented in the PR description. This needs to be explained.

@luoliwoshang luoliwoshang changed the title only keep esp32 flag .go task3:machine lib Sep 10, 2025
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.

1 participant