Skip to content

Commit

Permalink
Add a frame-larger-than= pragma in the files where the stack frame ca…
Browse files Browse the repository at this point in the history
…nnot be reduced.

Make hm2_pkuart_send() use const in the parameters so that the caller can have the data i R/O data memory.
  • Loading branch information
BsAtHome committed Jan 23, 2025
1 parent bd70738 commit 94496c5
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 5 deletions.
8 changes: 8 additions & 0 deletions src/emc/kinematics/genserfuncs.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@
#include "rtapi.h"
#endif

// Only gcc/g++ supports the #pragma
#if __GNUC__ && !defined(__clang__)
// The matrix and vector storage is just big.
// genser_kin_jac_inv() is 2112
// genserKinematicsInverse() is 2576
#pragma GCC diagnostic warning "-Wframe-larger-than=2600"
#endif

static struct haldata {
hal_u32_t *max_iterations;
hal_u32_t *last_iterations;
Expand Down
6 changes: 6 additions & 0 deletions src/emc/tp/tp.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
#include "hal.h"
#endif // }

// Only gcc/g++ supports the #pragma
#if __GNUC__ && !defined(__clang__)
// tpHandleBlendArc() is 2512
#pragma GCC diagnostic warning "-Wframe-larger-than=2600"
#endif

static emcmot_status_t *emcmotStatus;
static emcmot_config_t *emcmotConfig;

Expand Down
9 changes: 7 additions & 2 deletions src/hal/components/mesa_pktgyro_test.comp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ FUNCTION(receive){


}
// Only gcc/g++ supports the #pragma
#if __GNUC__ && !defined(__clang__)
// EXTRA_SETUP() is 2400
#pragma GCC diagnostic warning "-Wframe-larger-than=2500"
#endif

EXTRA_SETUP(){ // the names parameters are passed in 'prefix'.
if (prefix[0] == 'm'){ // should be the 'm' of hm2_....
Expand Down Expand Up @@ -238,7 +243,7 @@ EXTRA_SETUP(){ // the names parameters are passed in 'prefix'.
and receive 16 ACK datagrams as replies.
*/

static unsigned char disable16[11*16] ={
static const unsigned char disable16[11*16] ={
0x75, 0x65, 0x0C,0x05, 0x05,0x11, 0x01,0x01, 0x00, 0x03, 0x19,
0x75, 0x65, 0x0C,0x05, 0x05,0x11, 0x01,0x01, 0x00, 0x03, 0x19,
0x75, 0x65, 0x0C,0x05, 0x05,0x11, 0x01,0x01, 0x00, 0x03, 0x19,
Expand All @@ -259,7 +264,7 @@ EXTRA_SETUP(){ // the names parameters are passed in 'prefix'.
0x75, 0x65, 0x0C,0x05, 0x05,0x11, 0x01,0x01, 0x00, 0x03, 0x19,
0x75, 0x65, 0x0C,0x05, 0x05,0x11, 0x01,0x01, 0x00, 0x03, 0x19
};
static rtapi_u16 disable_size16[16]={11,11,11,11, 11,11,11,11, 11,11,11,11, 11,11,11,11};
static const rtapi_u16 disable_size16[16]={11,11,11,11, 11,11,11,11, 11,11,11,11, 11,11,11,11};
num_frames = 16;
retval=hm2_pktuart_send(name, disable16, &num_frames, disable_size16);
rtapi_print_msg(RTAPI_MSG_INFO, "%s sent: bytes %d, frames %u\n", name, retval, num_frames);
Expand Down
2 changes: 1 addition & 1 deletion src/hal/drivers/mesa-hostmot2/hostmot2-serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ int hm2_pktuart_setup(char *name, int bitrate, rtapi_s32 tx_mode, rtapi_s32 rx_m
int hm2_pktuart_setup_rx(char *name, unsigned int bitrate, unsigned int filter_hz, unsigned int parity, int frame_delay, bool rx_enable, bool rx_mask);
int hm2_pktuart_setup_tx(char *name, unsigned int bitrate, unsigned int parity, int frame_delay, bool drive_enable, bool drive_auto, int enable_delay);
void hm2_pktuart_reset(char *name);
int hm2_pktuart_send(char *name, unsigned char data[], rtapi_u8 *num_frames, rtapi_u16 frame_sizes[]);
int hm2_pktuart_send(char *name, const unsigned char data[], rtapi_u8 *num_frames, const rtapi_u16 frame_sizes[]);
int hm2_pktuart_read(char *name, unsigned char data[], rtapi_u8 *num_frames, rtapi_u16 *max_frame_length, rtapi_u16 frame_sizes[]);
int hm2_pktuart_queue_get_frame_sizes(char *name, rtapi_u32 fsizes[]);
int hm2_pktuart_queue_read_data(char *name, rtapi_u32 *data, int bytes);
Expand Down
2 changes: 1 addition & 1 deletion src/hal/drivers/mesa-hostmot2/hostmot2.h
Original file line number Diff line number Diff line change
Expand Up @@ -1974,7 +1974,7 @@ int hm2_pktuart_setup(char *name, unsigned int bitrate, rtapi_s32 tx_mode, rtapi
int hm2_pktuart_setup_rx(char *name, unsigned int bitrate, unsigned int filter_hz, unsigned int parity, int frame_delay, bool rx_enable, bool rx_mask);
int hm2_pktuart_setup_tx(char *name, unsigned int bitrate, unsigned int parity, int frame_delay, bool drive_enable, bool drive_auto, int enable_delay);
void hm2_pktuart_reset(char *name);
int hm2_pktuart_send(char *name, unsigned char data[], rtapi_u8 *num_frames, rtapi_u16 frame_sizes[]);
int hm2_pktuart_send(char *name, const unsigned char data[], rtapi_u8 *num_frames, rtapi_u16 const frame_sizes[]);
int hm2_pktuart_read(char *name, unsigned char data[], rtapi_u8 *num_frames, rtapi_u16 *max_frame_length, rtapi_u16 frame_sizes[]);

//
Expand Down
2 changes: 1 addition & 1 deletion src/hal/drivers/mesa-hostmot2/pktuart.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ int hm2_pktuart_setup(char *name, unsigned int bitrate, rtapi_s32 tx_mode, rtapi


EXPORT_SYMBOL_GPL(hm2_pktuart_send);
int hm2_pktuart_send(char *name, unsigned char data[], rtapi_u8 *num_frames, rtapi_u16 frame_sizes[])
int hm2_pktuart_send(char *name, const unsigned char data[], rtapi_u8 *num_frames, const rtapi_u16 frame_sizes[])
{
hostmot2_t *hm2;
rtapi_u32 buff;
Expand Down

0 comments on commit 94496c5

Please sign in to comment.