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

Save and load compiled version #11

Open
Benjamin-Loison opened this issue Jun 5, 2024 · 8 comments
Open

Save and load compiled version #11

Benjamin-Loison opened this issue Jun 5, 2024 · 8 comments

Comments

@Benjamin-Loison
Copy link
Owner

Benjamin-Loison commented Jun 5, 2024

Maybe I have in mind FrameworkComputer/EmbeddedController/pull/12, source: Benjamin-Loison/cinnamon/issues/67#issuecomment-2146256288.

@Benjamin-Loison
Copy link
Owner Author

Benjamin-Loison commented Sep 3, 2024

I am just doubting about FP_BREATH_OFF.

grep -rw 'FP_LED_LOW'
led.c:38:#define FP_LED_LOW 15
led.c:394:		led_level = FP_LED_LOW;

So FP_LED_OFF seems legitimate.

grep -rwn 'FP_LED_BRIGHTNESS_LOW'
led.c:345:		case FP_LED_BRIGHTNESS_LOW:
led.c:393:	case FP_LED_BRIGHTNESS_LOW:
host_command_customization.h:187:	FP_LED_BRIGHTNESS_LOW = 2,

So FP_LED_BRIGHTNESS_OFF seems legitimate.

I would be curious what 1 instead of 0 visually look like, it may be enough as in #13.

I am just a bit fearing not clearly seeing whether or not the laptop is sleeping or not for power consumption and privacy.

grep -rwn 'FP_BREATH_LOW'
led.c:40:#define FP_BREATH_LOW 20
led.c:346:			breath_led_level = FP_BREATH_LOW;
led.c:395:		breath_led_level = FP_BREATH_LOW;

So FP_BREATH_LOW looks legitimate.

grep -rwn 'BREATH_ON_LENGTH_LOW'
led.c:33:#define BREATH_ON_LENGTH_LOW	90
led.c:347:			breath_led_length = BREATH_ON_LENGTH_LOW;
led.c:396:		breath_led_length = BREATH_ON_LENGTH_LOW;

I would say that no matter if setting breath_led_length to 0 or infinity makes sense, the priod would just be about varying from 0 (as far as I know) to 0, so doing it correctly is less important. We can just hope that there is no hidden condition looking for such edge case and going on with an unusual procedure.

So how to compile now?

@Benjamin-Loison
Copy link
Owner Author

Benjamin-Loison commented Sep 3, 2024

@Benjamin-Loison
Copy link
Owner Author

Benjamin-Loison commented Sep 3, 2024

ls
board.c      cpu_power.h    gpio.inc                      i2c_hid_mediakeys.h       lfw                   power_sequence.c
board.h      cypress5525.c  host_command_customization.c  keyboard_customization.c  peci_customization.c  power_sequence.h
build.mk     cypress5525.h  host_command_customization.h  keyboard_customization.h  peci_customization.h  ucsi.c
cpu_power.c  ec.tasklist    i2c_hid_mediakeys.c           led.c                     power_button_x86.c    ucsi.h

In the context of #13 I use:

sudo EmbeddedController/build/hx30/util/ectool pwmsetkblight 1

So I should figure out if hx20 or hx30 is appropriate for my Framework 13.

blob/553827caae7134d45a0617af9c201e333eab9a26/README.md#framework-laptop-ec

grep 'model name' -m 1 /proc/cpuinfo
model name	: 12th Gen Intel(R) Core(TM) i5-1240P

So hx30 is appropriate in my case.

Should seriously consider the warning (blob/553827caae7134d45a0617af9c201e333eab9a26/README.md#warning) that this may break my laptop. Is there any way to revert the change if it breaks things?

@Benjamin-Loison
Copy link
Owner Author

In hx30:

ls
board.c      cpu_power.h    gpio.inc                      i2c_hid_mediakeys.h       lfw                   power_button_x86.c  ucsi.h
board.h      cypress5525.c  host_command_customization.c  keyboard_customization.c  peci_customization.c  power_sequence.c
build.mk     cypress5525.h  host_command_customization.h  keyboard_customization.h  peci_customization.h  power_sequence.h
cpu_power.c  ec.tasklist    i2c_hid_mediakeys.c           led.c                     peci_over_espi.c      ucsi.c

@Benjamin-Loison
Copy link
Owner Author

Benjamin-Loison commented Sep 3, 2024

make
make: *** No targets specified and no makefile found.  Stop.
ls build/hx30
ec.bin  ec.obj  ec_version.h  firmware_image.lds  firmware_image.lds.d  gen  libsharedobjs  RO  RW  util
make BOARD=hx30 CROSS_COMPILE=arm-none-eabi-
  LDS     firmware_image.lds
  LDS     RW/ec.RW.lds
  VERSION ec_version.h
  CC      RW/baseboard/fwk/baseboard_host_commands.o
  CC      RW/baseboard/fwk/battery.o
  CC      RW/baseboard/fwk/diagnostics.o
  CC      RW/baseboard/fwk/fan.o
  CC      RW/baseboard/fwk/flash_storage.o
  CC      RW/baseboard/fwk/ps2mouse.o
  CC      RW/board/hx30/board.o
  CC      RW/board/hx30/cpu_power.o
  CC      RW/board/hx30/cypress5525.o
  CC      RW/board/hx30/host_command_customization.o
  CC      RW/board/hx30/i2c_hid_mediakeys.o
  CC      RW/board/hx30/keyboard_customization.o
  CC      RW/board/hx30/led.o
  CC      RW/board/hx30/peci_customization.o
  CC      RW/board/hx30/peci_over_espi.o
  CC      RW/board/hx30/power_button_x86.o
  CC      RW/board/hx30/power_sequence.o
  CC      RW/board/hx30/ucsi.o
  CC      RW/chip/mchp/adc.o
  CC      RW/chip/mchp/clock.o
  CC      RW/chip/mchp/dma.o
  CC      RW/chip/mchp/espi.o
  CC      RW/chip/mchp/fan.o
  CC      RW/chip/mchp/flash.o
  CC      RW/chip/mchp/gpio.o
  CC      RW/chip/mchp/hwtimer.o
  CC      RW/chip/mchp/i2c.o
  CC      RW/chip/mchp/keyboard_raw.o
  CC      RW/chip/mchp/lpc.o
  CC      RW/chip/mchp/peci.o
  CC      RW/chip/mchp/port80.o
  CC      RW/chip/mchp/pwm.o
  CC      RW/chip/mchp/qmspi.o
  CC      RW/chip/mchp/spi.o
  CC      RW/chip/mchp/system.o
  CC      RW/chip/mchp/tfdp.o
  CC      RW/chip/mchp/uart.o
  CC      RW/chip/mchp/watchdog.o
  CC      RW/common/acpi.o
  CC      RW/common/adc.o
  CC      RW/common/als.o
  CC      RW/common/battery.o
  CC      RW/common/charge_manager.o
  CC      RW/common/charge_state_v2.o
  CC      RW/common/charger.o
  CC      RW/common/chipset.o
  CC      RW/common/console.o
  CC      RW/common/console_output.o
  CC      RW/common/dptf.o
  CC      RW/common/ec_features.o
  CC      RW/common/espi.o
  CC      RW/common/extpower_common.o
  CC      RW/common/extpower_gpio.o
  CC      RW/common/fan.o
  CC      RW/common/flash.o
  CC      RW/common/fmap.o
  CC      RW/common/gpio.o
  CC      RW/common/gpio_commands.o
  CC      RW/common/hooks.o
  CC      RW/common/host_command.o
  CC      RW/common/host_event_commands.o
  CC      RW/common/i2c_master.o
  CC      RW/common/i2c_slave.o
  CC      RW/common/i2c_trace.o
  CC      RW/common/init_rom.o
  CC      RW/common/keyboard_8042.o
  CC      RW/common/keyboard_8042_sharedlib.o
  CC      RW/common/keyboard_backlight.o
  CC      RW/common/keyboard_scan.o
  CC      RW/common/keyboard_vivaldi.o
  CC      RW/common/led_common.o
  CC      RW/common/led_pwm.o
  CC      RW/common/lid_switch.o
  CC      RW/common/main.o
  CC      RW/common/memory_commands.o
  CC      RW/common/panic_output.o
  CC      RW/common/peci.o
  CC      RW/common/peripheral.o
  CC      RW/common/port80.o
  CC      RW/common/power_button.o
  CC      RW/common/printf.o
  CC      RW/common/pwm.o
  CC      RW/common/queue.o
  CC      RW/common/queue_policies.o
  CC      RW/common/sha256.o
  CC      RW/common/shared_mem.o
  CC      RW/common/spi_commands.o
  CC      RW/common/spi_flash.o
  CC      RW/common/spi_flash_reg.o
  CC      RW/common/switch.o
  CC      RW/common/system.o
  CC      RW/common/temp_sensor.o
  CC      RW/common/thermal.o
  CC      RW/common/throttle_ap.o
  CC      RW/common/timer.o
  CC      RW/common/uart_buffering.o
  CC      RW/common/uptime.o
  CC      RW/common/util.o
  CC      RW/common/version.o
  CC      RW/common/vstore.o
  CC      RW/core/cortex-m/cpu.o
  AS      RW/core/cortex-m/init.o
  CC      RW/core/cortex-m/llsr.o
  CC      RW/core/cortex-m/panic.o
  AS      RW/core/cortex-m/switch.o
  CC      RW/core/cortex-m/task.o
  CC      RW/core/cortex-m/vecttable.o
  CC      RW/core/cortex-m/watchdog.o
  CC      RW/driver/als_cm32183.o
  CC      RW/driver/battery/smart.o
  CC      RW/driver/charger/isl9241.o
  CC      RW/driver/temp_sensor/f75303.o
  CC      RW/driver/temp_sensor/f75397.o
  CC      RW/power/common.o
  CC      RW/power/host_sleep.o
  LD      RW/ec.RW.elf
  NM      RW/ec.RW.smap
  OBJCOPY RW/ec.RW.flat
  LDS     RO/ec.RO.lds
  CC      RO/baseboard/fwk/baseboard_host_commands.o
  CC      RO/baseboard/fwk/battery.o
  CC      RO/baseboard/fwk/diagnostics.o
  CC      RO/baseboard/fwk/fan.o
  CC      RO/baseboard/fwk/flash_storage.o
  CC      RO/baseboard/fwk/ps2mouse.o
  CC      RO/board/hx30/board.o
  CC      RO/board/hx30/cpu_power.o
  CC      RO/board/hx30/cypress5525.o
  CC      RO/board/hx30/host_command_customization.o
  CC      RO/board/hx30/i2c_hid_mediakeys.o
  CC      RO/board/hx30/keyboard_customization.o
  CC      RO/board/hx30/led.o
  CC      RO/board/hx30/peci_customization.o
  CC      RO/board/hx30/peci_over_espi.o
  CC      RO/board/hx30/power_button_x86.o
  CC      RO/board/hx30/power_sequence.o
  CC      RO/board/hx30/ucsi.o
  CC      RO/chip/mchp/adc.o
  CC      RO/chip/mchp/clock.o
  CC      RO/chip/mchp/dma.o
  CC      RO/chip/mchp/espi.o
  CC      RO/chip/mchp/fan.o
  CC      RO/chip/mchp/flash.o
  CC      RO/chip/mchp/gpio.o
  CC      RO/chip/mchp/hwtimer.o
  CC      RO/chip/mchp/i2c.o
  CC      RO/chip/mchp/keyboard_raw.o
  CC      RO/chip/mchp/lpc.o
  CC      RO/chip/mchp/peci.o
  CC      RO/chip/mchp/port80.o
  CC      RO/chip/mchp/pwm.o
  CC      RO/chip/mchp/qmspi.o
  CC      RO/chip/mchp/spi.o
  CC      RO/chip/mchp/system.o
  CC      RO/chip/mchp/tfdp.o
  CC      RO/chip/mchp/uart.o
  CC      RO/chip/mchp/watchdog.o
  CC      RO/common/acpi.o
  CC      RO/common/adc.o
  CC      RO/common/als.o
  CC      RO/common/battery.o
  CC      RO/common/charge_manager.o
  CC      RO/common/charge_state_v2.o
  CC      RO/common/charger.o
  CC      RO/common/chipset.o
  CC      RO/common/console.o
  CC      RO/common/console_output.o
  CC      RO/common/dptf.o
  CC      RO/common/ec_features.o
  CC      RO/common/espi.o
  CC      RO/common/extpower_common.o
  CC      RO/common/extpower_gpio.o
  CC      RO/common/fan.o
  CC      RO/common/flash.o
  CC      RO/common/fmap.o
  CC      RO/common/gpio.o
  CC      RO/common/gpio_commands.o
  CC      RO/common/hooks.o
  CC      RO/common/host_command.o
  CC      RO/common/host_event_commands.o
  CC      RO/common/i2c_master.o
  CC      RO/common/i2c_slave.o
  CC      RO/common/i2c_trace.o
  CC      RO/common/init_rom.o
  CC      RO/common/keyboard_8042.o
  CC      RO/common/keyboard_8042_sharedlib.o
  CC      RO/common/keyboard_backlight.o
  CC      RO/common/keyboard_scan.o
  CC      RO/common/keyboard_vivaldi.o
  CC      RO/common/led_common.o
  CC      RO/common/led_pwm.o
  CC      RO/common/lid_switch.o
  CC      RO/common/main.o
  CC      RO/common/memory_commands.o
  CC      RO/common/panic_output.o
  CC      RO/common/peci.o
  CC      RO/common/peripheral.o
  CC      RO/common/port80.o
  CC      RO/common/power_button.o
  CC      RO/common/printf.o
  CC      RO/common/pwm.o
  CC      RO/common/queue.o
  CC      RO/common/queue_policies.o
  CC      RO/common/sha256.o
  CC      RO/common/shared_mem.o
  CC      RO/common/spi_commands.o
  CC      RO/common/spi_flash.o
  CC      RO/common/spi_flash_reg.o
  CC      RO/common/switch.o
  CC      RO/common/system.o
  CC      RO/common/temp_sensor.o
  CC      RO/common/thermal.o
  CC      RO/common/throttle_ap.o
  CC      RO/common/timer.o
  CC      RO/common/uart_buffering.o
  CC      RO/common/uptime.o
  CC      RO/common/util.o
  CC      RO/common/version.o
  CC      RO/common/vstore.o
  CC      RO/core/cortex-m/cpu.o
  AS      RO/core/cortex-m/init.o
  CC      RO/core/cortex-m/llsr.o
  CC      RO/core/cortex-m/panic.o
  AS      RO/core/cortex-m/switch.o
  CC      RO/core/cortex-m/task.o
  CC      RO/core/cortex-m/vecttable.o
  CC      RO/core/cortex-m/watchdog.o
  CC      RO/driver/als_cm32183.o
  CC      RO/driver/battery/smart.o
  CC      RO/driver/charger/isl9241.o
  CC      RO/driver/temp_sensor/f75303.o
  CC      RO/driver/temp_sensor/f75397.o
  CC      RO/power/common.o
  CC      RO/power/host_sleep.o
  LD      RO/ec.RO.elf
  NM      RO/ec.RO.smap
  OBJCOPY RO/ec.RO.flat
  CAT     ec.obj
  LD      RW/chip/mchp/lfw/ec_lfw-lfw.elf
  NM      RW/chip/mchp/lfw/ec_lfw-lfw.smap
  OBJCOPY RW/chip/mchp/lfw/ec_lfw-lfw.flat
  OBJCOPY ec.bin
  COPY_RW ec.bin
  MV      ec.bin
  BUILDCC util/export_taskinfo_ro.o
  BUILDCC util/export_taskinfo_rw.o
  BUILDLD util/export_taskinfo.so
  *** 54272 bytes in flash and 36008 bytes in RAM still available on hx30 RO ****
  *** 54624 bytes in flash and 36008 bytes in RAM still available on hx30 RW ****
ls build/hx30
ec.bin  ec.obj  ec_version.h  firmware_image.lds  firmware_image.lds.d  gen  libsharedobjs  RO  RW  util

@Benjamin-Loison
Copy link
Owner Author

@Benjamin-Loison
Copy link
Owner Author

Benjamin-Loison commented Sep 10, 2024

The output artifact is build/hx20/ec.bin which can be flashed to the EC SPI flash ROM.

Source: EmbeddedController/blob/553827caae7134d45a0617af9c201e333eab9a26/README.md?plain=1#L42

EC probably refers to Embedded Controller
SPI probably refers to Wikipedia: Serial Peripheral Interface

@Benjamin-Loison
Copy link
Owner Author

EC Flash configuration

When flashing the EC for Framework Laptops with Intel 11th Gen Core Processors, do not erase or overwrite the sectors 0x3C000 to 0x3FFFF, or 0x79000 to 0x7FFFF.

Currently the EC only runs from the ro region.

00000000:00000fff bootsector
00001000:00039fff lfwro
00040000:00078fff rw

Source: EmbeddedController/blob/553827caae7134d45a0617af9c201e333eab9a26/README.md?plain=1#L44-L53

until EmbeddedController/blob/553827caae7134d45a0617af9c201e333eab9a26/README.md#embedded-controller-ec they do not seem to explain how to actually flash. Maybe should investigate the BIOS and similar menus.

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

1 participant