aboutsummaryrefslogtreecommitdiffstats
path: root/src/pru
Commit message (Collapse)AuthorAgeFilesLines
* Rename everything significant to Kutter except for docsTomasz Kramkowski2025-08-152-5/+5
|
* Revert "Makefile: Don't disable gcc's use-linker-plugin option"Kevin O'Connor2025-04-161-1/+0
| | | | | | | | This reverts commit 8087200ffe2fbbe62265dd480ce8be67db8349eb. The change can break the build on some versions of gcc. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Kconfig: Add new WANT_ADC option to reduce code sizeKevin O'Connor2025-04-161-1/+1
| | | | | | | Make it possible to not compile in support for ADC on chips with small flash sizes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Makefile: Don't disable gcc's use-linker-plugin optionKevin O'Connor2025-04-161-0/+1
| | | | | | | | | | | | | | | | This option seems to be confusing ld's region usage checks (builds that could fit in small chips are being reported as not fitting). The option was disabled back in commit 4e8674d5 because it showed worse results. However, recent versions of gcc seem to produce the same results even if this option is enabled, so change the build to avoid disabling that option on newer versions of gcc (those that have the -ffat-lto-objects option - which is needed to ensure compile_time_requests sections can be extracted with objcopy). The PRU build is dependent on -fuse-linker-plugin, so enable that option explicitly in its build. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Support 2-byte message idsKevin O'Connor2024-06-101-1/+1
| | | | | | | | Allow command ids, response ids, and output ids to be either 1 or 2 bytes long. This increases the total number of message types from 128 to 16384. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: BeagleBone Firmware upgrade to Debian 11.7 Bullseye (#6577)Oleg Gavavka2024-04-277-140/+191
| | | | | | | | | | | | | | | * Porting BeagleBone to Kernel 5.10 * Fixing issue with installation for BeagleBone. This fix resolve 2 issue: 1. Conflict with AVR packages. 2. "klipper_pru" script is executed before PRU cores are ready * Adding additional steps to BeagleBone install guide. * Updating BeagleBone documentation, adding different use cases, adding buses configurations SPI, I2C, CAN, UART Signed-off-by: Oleg Gavavka <work@datalink.net.ua>
* Kconfig: Support selecting optional features on chips with small flash sizeKevin O'Connor2023-06-081-0/+1
| | | | | | | | | | | | | Add a new HAVE_LIMITED_CODE_SIZE symbol that enables a menu to select optional features. This symbol is enabled on chips with small build sizes. Replace the HAVE_GPIO_BITBANGING with four new symbols: WANT_GPIO_BITBANGING, WANT_DISPLAYS, WANT_SENSORS, WANT_SOFTWARE_SPI, and WANT_SOFTWARE_I2C. This allows users a little more flexibility when selecting features they need. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* misc: Import misc.h in all files defining console_sendf()Kevin O'Connor2022-05-131-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Perform message encoding on pru0 to free space on pru1Kevin O'Connor2021-10-213-37/+66
| | | | | | | | Copy the parameters of calls to console_sendf() on pru1 to pru0 and then call that function on pru0. Although copying the parameters is a "hack", the code size reduction is notable. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Makefile: Include debug symbols in the .elfSergey Alirzaev2021-06-081-0/+2
| | | | Signed-off-by: Sergey Alirzaev <zl29ah@gmail.com>
* pru: Request the host not send more than 496 bytes to the pruKevin O'Connor2021-02-121-0/+3
| | | | | | | | Writes over 496 bytes don't fit in a single "rpmsg" page. Request the host limit the number of bytes outstanding to avoid getting "write: (22)Invalid argument" errors. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Disable gpio mux configuration codeKevin O'Connor2020-12-041-9/+19
| | | | | | | | The code isn't actually capable of altering the mux registers due to hardware checks enforced by the chip. Disable that code to save a few bytes in the final binary. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Kconfig: Add a new CONFIG_HAVE_STRICT_TIMING build definitionKevin O'Connor2020-05-311-0/+1
| | | | | | | | Add a new build definition to note micro-controllers that have strict timing. The Linux mcu code does not have strict timing - all other targets currently do. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: The TMR_CNT is cleared by writing all onesKevin O'Connor2019-03-311-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Avoid using a timer wake time of exactly zeroKevin O'Connor2019-03-311-0/+2
| | | | | | | | It appears the PRU timer will not trigger on a match of exactly zero. If the next timer happened to be set to exactly zero, it could cause software timers to get stuck and result in "move queue empty" errors. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Use enumerations for pin mappingsKevin O'Connor2019-03-172-0/+7
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Always pass a string to the DECL_CONSTANT() macroKevin O'Connor2019-03-172-2/+2
| | | | | | | | Make it clear that the name of the constant being defined is a string. When the value being defined is also a string, use a new DECL_CONSTANT_STR() macro. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Makefile: Reduce use of $^ in build rulesKevin O'Connor2019-03-021-1/+1
| | | | | | | It's rare to use all of a target's prerequisites in a recipe - replace most cases with $< (the target's first prerequisite). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Wrap code to 80 columnsKevin O'Connor2019-02-272-21/+22
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Add wrappers for gpio_x_reset()Kevin O'Connor2018-08-272-0/+14
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Disable ADC reading directly from the PRUKevin O'Connor2018-06-271-1/+1
| | | | | | | | The PRU code size has grown too close to the maximum - remove the ADC code to reduce its overall size. (On the beaglebone, the Linux process can, and typically does, do the ADC reading.) Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Wait to send ack until after processing commandsKevin O'Connor2018-05-281-1/+3
| | | | | | | Send the ack after processing commands - this gives the host code more information on serial buffer utilization. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Prefer uint8_t* for buffers; prefer uint8_fast_t for lengthsKevin O'Connor2018-05-282-12/+12
| | | | | | | | | Prefer using 'uint8_t' buffers as it is too easy to run into C sign extension problems with 'char' buffers. Prefer using 'uint_fast8_t' for buffer lengths as gcc does a better job compiling them on 32bit mcus. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Introduce and use gpio_out_toggle_noirq()Kevin O'Connor2018-05-152-1/+8
| | | | | | | | | | | | | | | The gpio_out_toggle() function in the sam3x8e and stm32f1 code was only valid if it was called with irqs disabled. Commits 018c5daa and 9c52ad43 enabled the lcd code which called gpio_out_toggle() with irqs enabled. This could cause corruption of the gpio state. Introduce a gpio_out_toggle_noirq() function that will only be invoked with irqs disabled, and fix gpio_out_toggle() on sam3x8e and stm32f1 so that it safe to call even if irqs are enabled. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Don't reset the ADC reset complete flag if a shutdown occursKevin O'Connor2017-10-181-1/+1
| | | | | | Only set the have_done_reset flag if the reset completes successfully. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Avoid calling "slp" instruction on pru0Kevin O'Connor2017-09-111-1/+3
| | | | | | | | If pru0 waits in sleep mode then a full beaglebone reboot is needed to reprogram the pru0 firmware. For now, avoid using the "slp" instruction as a workaround. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Batch outgoing writesKevin O'Connor2017-09-081-5/+31
| | | | | | | Allow pru0 to gather multiple outgoing message blocks into a single rpmsg. This can reduce communication overhead. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Fix race condition in clearing of irq flagsKevin O'Connor2017-09-081-2/+4
| | | | | | | | Each irq flag must only be cleared after it has been serviced. This fixes a race condition that could cause incoming commands to be delayed for extended period. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Support config_reset command to manually reset mcuKevin O'Connor2017-09-031-0/+3
| | | | | | | Add support for resetting the MCU via a software only mechanism. This is useful on the PRU. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Only sleep the pru0 if the incoming queue is fully emptyKevin O'Connor2017-09-031-5/+7
| | | | | | | | It's possible for multiple blocks to be pending on the incoming "rpmsg" stream. Don't sleep unless the input is confirmed to be empty. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Compile the irq_poll() function with -O2 optimizationKevin O'Connor2017-08-151-1/+1
| | | | | | | | Compile the PRU binary with -Os optimization, but request that the timer dispatch code be compiled with -O2 optimization. This improves the performance of timers slightly. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Compile with -Os instead of -O2Kevin O'Connor2017-08-141-1/+1
| | | | | | | The gcc -Os option significantly reduces the size of the PRU binary and it has little impact on performance. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Don't pass max_size to command_encodef()Kevin O'Connor2017-08-142-4/+4
| | | | | | | | | The command_encodef() can read the max_size parameter directly from the 'struct command_encoder' passed into it. Also, there is no need to check that a message will fit in a buffer if the buffer is declared to be MESSAGE_MAX in size. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Implement generic sleep mechanism based on tasks pendingKevin O'Connor2017-08-081-7/+1
| | | | | | | | | Track when tasks are pending and spin in irq_wait() when no tasks are pending. This improves the mechanism for sleeping the processor - it's simpler for the board specific code and it reduces the possibility of the processor sleeping when tasks are busy. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Introduce sched_wake_tasks() function to wake up tasksKevin O'Connor2017-08-081-2/+4
| | | | | | | | Add function to indicate when tasks need to be run. This will allow the scheduler code to know if there are any tasks that need to be processed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Support adding timers to the start of timer_listKevin O'Connor2017-08-081-12/+14
| | | | | | | | If sched_add_timer() is called on a timer that would make it the new head of the list, then add it and signal the board code that the timer should be rescheduled. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Improve comments in pru0.cKevin O'Connor2017-08-022-3/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* build: Allow boards to disable digital input/output supportKevin O'Connor2017-07-201-0/+1
| | | | | | | | Allow the micro-controller code to be built without support for regular gpio pins. In this case, the code for endstops, steppers, and gpiocmds will be disabled. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* basecmd: Move low-level alloc code into basecmd.cKevin O'Connor2017-07-201-25/+9
| | | | | | | | Implement new dynmem_start() and dynmem_end() functions instead of alloc_chunk() and alloc_chunks() in the board code. This simplifies the board code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* irq: Support sleeping when mcu is idleKevin O'Connor2017-07-172-2/+17
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Move peripheral init from pru0 to pru1Kevin O'Connor2017-07-173-45/+37
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Move ADC code from gpio.c to new file adc.cKevin O'Connor2017-07-123-66/+78
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Add support for "make flash" ruleKevin O'Connor2017-07-051-0/+4
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Use a pointer when working with send_data array itemsKevin O'Connor2017-06-303-17/+14
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Add hack to shutdown the PRU from a simple command requestKevin O'Connor2017-06-301-0/+6
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Rework command processing so that most of it is done on pru0Kevin O'Connor2017-06-304-77/+195
| | | | | | | | Change the command dispatch and response generation so that most of the work is done on pru0 instead of pru1. This allows more code to fit into the limited space on pru1. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Move low-level sendf transmission into board codeKevin O'Connor2017-06-291-2/+15
| | | | | | | | Export a new console_sendf() function from the board code instead of console_get_output() and console_push_output(). This enables more flexibility in how the board specific code produces output. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Move command_task() to board specific codeKevin O'Connor2017-06-291-2/+15
| | | | | | | | Move the command_task() code from the generic code to the board specific code. This enables more flexibility in how the board specific code processes input. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Remove unnecessary barrier() callsKevin O'Connor2017-06-162-5/+0
| | | | | | The writel() call already implements a barrier() internally. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* build: Use compile_time_request system for init, tasks, and shutdownKevin O'Connor2017-05-262-7/+11
| | | | | | | | Avoid using linker magic to define the init, task, and shutdown functions. Instead, use the compile_time_request system. This simplifies the build and produces more efficient code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>